Skip to content

Commit

Permalink
Update PHP-ext script result shape
Browse files Browse the repository at this point in the history
This aligns with what is returned within the WASM runtime.
  • Loading branch information
eddmann committed Jun 7, 2023
1 parent 4ff53b9 commit 8a3c110
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ php-ext/build:
.PHONY: php-ext/test
php-ext/test:
@docker build -t local/santa-php-ext-build - < runtime/php-ext/build.Dockerfile
@$(DOCKER) local/santa-php-ext-build bash -c "php -dextension=./target/release/libsanta_lang.so php-ext/fixtures/test.php"
@$(DOCKER) local/santa-php-ext-build bash -c "php -dextension=./target/release/libsanta_lang.so runtime/php-ext/fixtures/test.php"

cli/build/%:
@$(DOCKER) joseluisq/rust-linux-darwin-builder:1.68.2 \
Expand Down
7 changes: 2 additions & 5 deletions runtime/php-ext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ pub fn santa_aoc_run(source: &str, cwd: Option<String>) -> PhpResult<Zval> {

match runner.run(source) {
Ok(RunEvaluation::Script(result)) => {
let mut result_ht = ZendHashTable::new();
result_ht.insert("value", result.value)?;
result_ht.insert("duration", result.duration as u64)?;

let mut output_ht = ZendHashTable::new();
output_ht.insert("result", result_ht)?;
output_ht.insert("value", result.value)?;
output_ht.insert("duration", result.duration as u64)?;

let mut zval = Zval::new();
zval.set_hashtable(output_ht);
Expand Down

0 comments on commit 8a3c110

Please sign in to comment.