File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,6 @@ export class PhpBase extends EventTarget
123123
124124 inputString ( byteString )
125125 {
126- console . trace ( byteString ) ;
127126 this . input ( this . encoder . encode ( byteString ) ) ;
128127 }
129128
Original file line number Diff line number Diff line change @@ -42,10 +42,14 @@ char *_sapi_name = NULL;
4242 */
4343int EMSCRIPTEN_KEEPALIVE __attribute__((noinline )) pib_init (char * __sapi_name )
4444{
45- _sapi_name = __sapi_name ;
45+ if (!_sapi_name )
46+ {
47+ _sapi_name = malloc (strlen (__sapi_name ) + 1 );
48+ strcpy (_sapi_name , __sapi_name );
49+ }
50+
4651 putenv ("USE_ZEND_ALLOC=0" );
4752
48- // fprintf(stderr, "SAPI: %s...\n\n", _sapi_name);
4953 if (0 == strcmp (_sapi_name , "embed" ))
5054 {
5155 return php_embed_init (0 , NULL );
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ test('Can maintain memory between executions', async () => {
9090} ) ;
9191
9292test ( 'Can refresh memory between executions' , async ( ) => {
93- const php = new PhpNode ( ) ;
93+ const php = new PhpNode ( { } ) ;
9494
9595 let stdOut = '' , stdErr = '' ;
9696
@@ -101,10 +101,11 @@ test('Can refresh memory between executions', async () => {
101101 await php . run ( `<?php $i = 100;` ) ;
102102 await php . run ( `<?php $i++;` ) ;
103103 await php . refresh ( ) ;
104- await php . run ( `<?php ini_set('display_errors', 1); @error_reporting(E_ALL | E_STRICT); echo $i . PHP_EOL;` ) ;
104+ await php . run ( `<?php ini_set('display_errors', 1); @error_reporting(E_ALL | E_STRICT); var_dump($i) . PHP_EOL;` ) ;
105105
106- assert . equal ( stdOut , `\nWarning: Undefined variable $i in php-wasm run script on line 1\n \n` ) ;
106+ assert . equal ( stdOut , `\nWarning: Undefined variable $i in php-wasm run script on line 1\nNULL \n` ) ;
107107 assert . equal ( stdErr , '' ) ;
108+
108109} ) ;
109110
110111test ( 'Can read files from the local FS through PHP functions' , async ( ) => {
You can’t perform that action at this time.
0 commit comments