seanmorris / php-wasm

PHP in Browser, powered by WebAssembly.
https://php-wasm.seanmorr.is/
Apache License 2.0
781 stars 41 forks source link

Fatal error: strict_types declaration must be the very first statement in the script in php-wasm run script on line 2 #52

Open SjonHortensius opened 2 months ago

SjonHortensius commented 2 months ago

It seems the php.run() call passes through a slightly different argument than given - which I suspect is caused by this line:

https://github.com/seanmorris/php-wasm/blame/d3f8d93e8a1691dbf96d9e5825cee959a68fb136/source/PhpBase.js#L69

this can be reproduced by calling php.run('<?php declare(strict_types=1);')

This was originally reported as https://github.com/SjonHortensius/3v4l_org/issues/21

seanmorris commented 1 day ago

@SjonHortensius Ah, looks like my pre-parsing logic isn't as solid as I thought.