phpv8 / v8js

V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
http://pecl.php.net/package/v8js
MIT License
1.84k stars 200 forks source link

make it compile with PHP 7.4 on Windows #441

Closed Jan-E closed 4 years ago

Jan-E commented 4 years ago

This fixes compilation on Windows with PHP 7.4 See https://github.com/phpv8/v8js/commit/e153ff16519eb3266dafd024a2d316d84f93fb96#r38293957

The proof of the pudding: https://phpdev.toolsforresearch.com/php-7.4.5RC1-nts-Win32-vc15-x64.htm https://phpdev.toolsforresearch.com/php-7.4.5RC1-nts-Win32-vc15-x64.zip

Jan-E commented 4 years ago

This fixes compilation of PHP 7.4 on Windows, but the tests just do not proceed. The same same tests with PHP 7.3.17 RC1 NTS x64 result in these fairly good results:

=====================================================================
Number of tests :  177               175
Tests skipped   :    2 (  1.1%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (  0.6%) (  0.6%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :  174 ( 98.3%) ( 99.4%)
---------------------------------------------------------------------
Time taken      :   19 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Test V8::executeString() : Issue #250 (early free of array) ext\v8js\tests\issue_250_001.phpt]
=====================================================================
Jan-E commented 4 years ago

Output of the first test with PHP 7.4.5 RC1 NTS on Windows:

N:\php-sdk\php74dev\x64\Release\php-7.4.5RC1>
php N:\php-sdk\php72dev\ext\v8js\tests\array_access.php
int(20)
int(14)
string(7) "MyArray"
NULL
NULL

Fatal error: Uncaught V8JsScriptException: V8Js::compileString():4:
TypeError: PHP.myarr.join is not a function in N:\php-sdk\php71dev\ext\v8js\tests\array_access.php:40
Stack trace:
#0 N:\php-sdk\php71dev\ext\v8js\tests\array_access.php(40): V8Js->executeString('var_dump(P
HP.my...')
#1 {main}
  thrown in N:\php-sdk\php71dev\ext\v8js\tests\array_access.php on line 40

PHP stalls after generating this output, It does not exit. The php.ini for running the tests and the array_access.php:

[PHP]
include_path = ".;/php-sdk/php74dev/ext/v8js"
extension_dir = "ext"
extension=mbstring
extension=v8js
v8js.icudtl_dat_path=icudtl.dat

Mutatis mutandis the same php.ini was used for the tests in PHP 7.3

Jan-E commented 4 years ago

PHP.myarr.slice(5, 10).join(', ') results in a comparable error:

N:\php-sdk\php74dev\x64\Release\php-7.4.5RC1>
php N:\php-sdk\php70dev\ext\v8js\tests\array_access_test.php
int(20)
int(14)
string(7) "MyArray"
NULL
NULL

Fatal error: Uncaught V8JsScriptException: V8Js::compileString():5: TypeError:
PHP.myarr.slice is not a function in N:\php-sdk\php70dev\ext\v8js\tests\array_access_test.php:39
Stack trace:
#0 N:\php-sdk\php70dev\ext\v8js\tests\array_access_test.php(39): V8Js->executeString('var_d
ump(PHP.my...')
#1 {main}
  thrown in N:\php-sdk\php70dev\ext\v8js\tests\array_access_test.php on line 39
stesie commented 4 years ago

hej again :) ... thanks for your continued effort to support it on Windows.

I'm merging it right away, even with that one bug remaining. Maybe we should discuss that one on an issue ticket itself.

You might want to single step through v8js_array_access_named_getter function and have a look which path it takes. So the function looks suspicious anyways, I would have expected return statement within the error-catching if-statements :-\

hkdobrev commented 4 years ago

Would you release PHP 7.4 support in a new release?