mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 14:01:53 +00:00
Merge remote-tracking branch 'origin/master' into php7
This commit is contained in:
commit
059e0500fb
@ -38,6 +38,8 @@ sudo cp -R include/* /usr/include
|
|||||||
echo -e "create /usr/lib/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M
|
echo -e "create /usr/lib/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Then add `extension=v8js.so` to your php.ini file. If you have a separate configuration for CLI, add it there also.
|
||||||
|
|
||||||
* If the V8 library is newer than 4.4.9.1 you need to pass `snapshot=off` to
|
* If the V8 library is newer than 4.4.9.1 you need to pass `snapshot=off` to
|
||||||
`make`, otherwise the V8 library will not be usable
|
`make`, otherwise the V8 library will not be usable
|
||||||
(see V8 [Issue 4192](https://code.google.com/p/v8/issues/detail?id=4192))
|
(see V8 [Issue 4192](https://code.google.com/p/v8/issues/detail?id=4192))
|
||||||
|
@ -3,8 +3,11 @@ V8Js on MacOS
|
|||||||
|
|
||||||
Installation of V8Js on MacOS is pretty much straight forward.
|
Installation of V8Js on MacOS is pretty much straight forward.
|
||||||
|
|
||||||
First of all you need a pretty fresh installation of v8 library.
|
If you have [brew](https://brew.sh) around, just `brew install
|
||||||
If you have brew around, just `brew install v8` and you should be done.
|
php56-v8js` (or `php54-v8js` / `php55-v8js` depending on your PHP
|
||||||
|
version) and you should be done. This will install a recent version
|
||||||
|
of V8 along with this extension.
|
||||||
|
|
||||||
Otherwise you need to compile latest v8 manually.
|
Otherwise you need to compile latest v8 manually.
|
||||||
|
|
||||||
Compile latest v8
|
Compile latest v8
|
||||||
|
@ -24,6 +24,10 @@ Minimum requirements
|
|||||||
V8 implements ECMAScript as specified in ECMA-262, 5th edition.
|
V8 implements ECMAScript as specified in ECMA-262, 5th edition.
|
||||||
This extension makes use of V8 isolates to ensure separation between multiple V8Js instances and uses the new isolate-based mechanism to throw exceptions, hence the need for 3.24.6 or above.
|
This extension makes use of V8 isolates to ensure separation between multiple V8Js instances and uses the new isolate-based mechanism to throw exceptions, hence the need for 3.24.6 or above.
|
||||||
|
|
||||||
|
V8 releases are published rather quickly and the V8 team usually provides security support
|
||||||
|
for the version line shipped with the Chrome browser (stable channel) and newer (only).
|
||||||
|
For a version overview see https://omahaproxy.appspot.com/.
|
||||||
|
|
||||||
- PHP 7.0.0+
|
- PHP 7.0.0+
|
||||||
|
|
||||||
This embedded implementation of the V8 engine uses thread locking so it works with ZTS enabled.
|
This embedded implementation of the V8 engine uses thread locking so it works with ZTS enabled.
|
||||||
|
26
config.m4
26
config.m4
@ -46,12 +46,32 @@ if test "$PHP_V8JS" != "no"; then
|
|||||||
CPPFLAGS=$old_CPPFLAGS
|
CPPFLAGS=$old_CPPFLAGS
|
||||||
]);
|
]);
|
||||||
|
|
||||||
AC_CACHE_CHECK(how to disable c++11 narrowing warning, ac_cv_v8_narrowing, [
|
AC_CACHE_CHECK(how to allow c++11 narrowing, ac_cv_v8_narrowing, [
|
||||||
ac_cv_v8_narrowing=""
|
ac_cv_v8_narrowing=""
|
||||||
old_CXXFLAGS=$CXXFLAGS
|
old_CXXFLAGS=$CXXFLAGS
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
CXXFLAGS="-Wno-c++11-narrowing"
|
CXXFLAGS="-std="$ac_cv_v8_cstd
|
||||||
AC_TRY_RUN([int main() { unsigned int a[1] = { -1 }; (void) a; return 0; }],[ac_cv_v8_narrowing="-Wno-c++11-narrowing"],[],[])
|
AC_TRY_RUN([int main() {
|
||||||
|
struct { unsigned int x; } foo = {-1};
|
||||||
|
(void) foo;
|
||||||
|
return 0;
|
||||||
|
}], [ ac_cv_v8_narrowing="" ], [
|
||||||
|
CXXFLAGS="-Wno-c++11-narrowing -std="$ac_cv_v8_cstd
|
||||||
|
AC_TRY_RUN([int main() {
|
||||||
|
struct { unsigned int x; } foo = {-1};
|
||||||
|
(void) foo;
|
||||||
|
return 0;
|
||||||
|
}], [ ac_cv_v8_narrowing="-Wno-c++11-narrowing" ], [
|
||||||
|
CXXFLAGS="-Wno-narrowing -std="$ac_cv_v8_cstd
|
||||||
|
AC_TRY_RUN([int main() {
|
||||||
|
struct { unsigned int x; } foo = {-1};
|
||||||
|
(void) foo;
|
||||||
|
return 0;
|
||||||
|
}], [ ac_cv_v8_narrowing="-Wno-narrowing" ], [
|
||||||
|
AC_MSG_ERROR([cannot compile with narrowing])
|
||||||
|
], [])
|
||||||
|
], [])
|
||||||
|
], [])
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
CXXFLAGS=$old_CXXFLAGS
|
CXXFLAGS=$old_CXXFLAGS
|
||||||
]);
|
]);
|
||||||
|
52
package.xml
52
package.xml
@ -16,26 +16,25 @@
|
|||||||
<email>stesie@php.net</email>
|
<email>stesie@php.net</email>
|
||||||
<active>yes</active>
|
<active>yes</active>
|
||||||
</lead>
|
</lead>
|
||||||
<date>2015-09-26</date>
|
<date>2015-10-11</date>
|
||||||
<time>12:31:47</time>
|
<time>21:59:47</time>
|
||||||
<version>
|
<version>
|
||||||
<release>0.2.6</release>
|
<release>0.3.0</release>
|
||||||
<api>0.2.6</api>
|
<api>0.3.0</api>
|
||||||
</version>
|
</version>
|
||||||
<stability>
|
<stability>
|
||||||
<release>beta</release>
|
<release>stable</release>
|
||||||
<api>beta</api>
|
<api>stable</api>
|
||||||
</stability>
|
</stability>
|
||||||
<license uri="http://www.php.net/license">The MIT License (MIT)</license>
|
<license uri="http://www.php.net/license">The MIT License (MIT)</license>
|
||||||
<notes>
|
<notes>
|
||||||
- Fix reference counting issue on PHP->JS->PHP exception propagation
|
- Fix multi-threading with pthreads extension
|
||||||
|
- Remove v8 debug agent support (which is unsupported by V8 since 3.28.4)
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="/" name="/">
|
<dir baseinstalldir="/" name="/">
|
||||||
<file baseinstalldir="/" md5sum="9532b5359069afc8bdccb5e01c288493" name="js/json-template.js" role="data" />
|
<file baseinstalldir="/" md5sum="9532b5359069afc8bdccb5e01c288493" name="js/json-template.js" role="data" />
|
||||||
<file baseinstalldir="/" md5sum="a490e5a575deeceab9872035fbe74eb1" name="js/jstparser.js" role="data" />
|
<file baseinstalldir="/" md5sum="a490e5a575deeceab9872035fbe74eb1" name="js/jstparser.js" role="data" />
|
||||||
<file baseinstalldir="/" md5sum="f1143e3f74042890b6f1a5abce86a3c3" name="samples/debug_callback_line_processor.php" role="php" />
|
|
||||||
<file baseinstalldir="/" md5sum="a352c90590b7e13bad41b3c77928c84c" name="samples/debug_line_processor.php" role="php" />
|
|
||||||
<file baseinstalldir="/" md5sum="ddbae43f7979c5fe082e08ff4f2e8765" name="samples/dlopen.supp" role="src" />
|
<file baseinstalldir="/" md5sum="ddbae43f7979c5fe082e08ff4f2e8765" name="samples/dlopen.supp" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="045e094122747e8e71f02ffc1ba88d4a" name="samples/test_call.php" role="php" />
|
<file baseinstalldir="/" md5sum="045e094122747e8e71f02ffc1ba88d4a" name="samples/test_call.php" role="php" />
|
||||||
<file baseinstalldir="/" md5sum="87cb416c6bc17d657abbbf314a41ff85" name="samples/test_callback.php" role="php" />
|
<file baseinstalldir="/" md5sum="87cb416c6bc17d657abbbf314a41ff85" name="samples/test_callback.php" role="php" />
|
||||||
@ -150,6 +149,7 @@
|
|||||||
<file baseinstalldir="/" md5sum="4dd56ff553d5a79c2157848d51a7bd52" name="tests/property_visibility.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="4dd56ff553d5a79c2157848d51a7bd52" name="tests/property_visibility.phpt" role="test" />
|
||||||
<file baseinstalldir="/" md5sum="b1b46869cf9db29d38c50964a9fea8f7" name="tests/property_visibility__get.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="b1b46869cf9db29d38c50964a9fea8f7" name="tests/property_visibility__get.phpt" role="test" />
|
||||||
<file baseinstalldir="/" md5sum="76bdcf96941321e372516413f65c8576" name="tests/property_visibility__set.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="76bdcf96941321e372516413f65c8576" name="tests/property_visibility__set.phpt" role="test" />
|
||||||
|
<file baseinstalldir="/" md5sum="794b8e67cad67f72a5c0786b9ba72547" name="tests/pthreads_001.phpt" role="test" />
|
||||||
<file baseinstalldir="/" md5sum="5a97aad8f07d8a9a67882b614e956c72" name="tests/regression_121.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="5a97aad8f07d8a9a67882b614e956c72" name="tests/regression_121.phpt" role="test" />
|
||||||
<file baseinstalldir="/" md5sum="3b256c85a054b728a37b3429d4157f02" name="tests/return_value.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="3b256c85a054b728a37b3429d4157f02" name="tests/return_value.phpt" role="test" />
|
||||||
<file baseinstalldir="/" md5sum="1a9c261661b08cfc6879f7f427b9f0de" name="tests/serialize_001.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="1a9c261661b08cfc6879f7f427b9f0de" name="tests/serialize_001.phpt" role="test" />
|
||||||
@ -171,30 +171,28 @@
|
|||||||
<file baseinstalldir="/" md5sum="35ce3816ae00e697fca26142c46e0c79" name="tests/v8_write_property.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="35ce3816ae00e697fca26142c46e0c79" name="tests/v8_write_property.phpt" role="test" />
|
||||||
<file baseinstalldir="/" md5sum="ae504a63e5ff800e3aa7d529835d0e8e" name="tests/variable_passing.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="ae504a63e5ff800e3aa7d529835d0e8e" name="tests/variable_passing.phpt" role="test" />
|
||||||
<file baseinstalldir="/" md5sum="1bd7738aeeb5cf80d80561554f59f2ed" name="tests/var_dump.phpt" role="test" />
|
<file baseinstalldir="/" md5sum="1bd7738aeeb5cf80d80561554f59f2ed" name="tests/var_dump.phpt" role="test" />
|
||||||
<file baseinstalldir="/" md5sum="63c4b2873ccc935571ae7fbb1baeab7b" name="config.m4" role="src" />
|
<file baseinstalldir="/" md5sum="8d1bdd18cc65d7328876dffca99cf0a9" name="config.m4" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="987d834d2edc84ead98dc1fddba2ad73" name="config.w32" role="src" />
|
<file baseinstalldir="/" md5sum="dd848985051c6e0db6e8037d5b9529da" name="config.w32" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="cea72666538d5b0b80a64ccdbda24919" name="CREDITS" role="doc" />
|
<file baseinstalldir="/" md5sum="cea72666538d5b0b80a64ccdbda24919" name="CREDITS" role="doc" />
|
||||||
<file baseinstalldir="/" md5sum="9f5b5f41204bcde55d9df87d5a970b30" name="LICENSE" role="doc" />
|
<file baseinstalldir="/" md5sum="9f5b5f41204bcde55d9df87d5a970b30" name="LICENSE" role="doc" />
|
||||||
<file baseinstalldir="/" md5sum="25260e0bc3111b01f700fad13544d6a9" name="Makefile.frag" role="src" />
|
<file baseinstalldir="/" md5sum="679b9046688ed6f60969415b182b1cac" name="Makefile.frag" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="31e331386def7ce98943694151c0d5cb" name="Makefile.travis" role="src" />
|
<file baseinstalldir="/" md5sum="31e331386def7ce98943694151c0d5cb" name="Makefile.travis" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="0e23fa6446e52a3b1cff8b18a6e0bd79" name="php_v8js.h" role="src" />
|
<file baseinstalldir="/" md5sum="0e23fa6446e52a3b1cff8b18a6e0bd79" name="php_v8js.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="0d986531818b0e31633f2db3a242afb7" name="php_v8js_macros.h" role="src" />
|
<file baseinstalldir="/" md5sum="2d42ed24043ef4a6ab4bccdbda45eb89" name="php_v8js_macros.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="ec19e63ca9310bfc4dc4dbd357c779ae" name="README.Linux.md" role="doc" />
|
<file baseinstalldir="/" md5sum="ec19e63ca9310bfc4dc4dbd357c779ae" name="README.Linux.md" role="doc" />
|
||||||
<file baseinstalldir="/" md5sum="4a65a3f9995d325a2c2ccb23224ea503" name="README.MacOS.md" role="doc" />
|
<file baseinstalldir="/" md5sum="4a65a3f9995d325a2c2ccb23224ea503" name="README.MacOS.md" role="doc" />
|
||||||
<file baseinstalldir="/" md5sum="177459a9628e3c8c31b305f20c970f8d" name="README.md" role="doc" />
|
<file baseinstalldir="/" md5sum="b390530f1587c71e605806601a7f13eb" name="README.md" role="doc" />
|
||||||
<file baseinstalldir="/" md5sum="9839870e001306943797003e8828d855" name="README.Win32.md" role="doc" />
|
<file baseinstalldir="/" md5sum="9839870e001306943797003e8828d855" name="README.Win32.md" role="doc" />
|
||||||
<file baseinstalldir="/" md5sum="542f52c54898f33ac53b173970cba305" name="test.php" role="php" />
|
<file baseinstalldir="/" md5sum="542f52c54898f33ac53b173970cba305" name="test.php" role="php" />
|
||||||
<file baseinstalldir="/" md5sum="65294fadb5ed766094b1f587fc20ad37" name="TODO" role="doc" />
|
<file baseinstalldir="/" md5sum="65294fadb5ed766094b1f587fc20ad37" name="TODO" role="doc" />
|
||||||
<file baseinstalldir="/" md5sum="cc54d77b4d0044d7b143989f2dc12b94" name="v8js.cc" role="src" />
|
<file baseinstalldir="/" md5sum="16c060e49d1b2c477531758e1de4850e" name="v8js.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="358c628b2627319e40fd7e5092f19872" name="v8js_array_access.cc" role="src" />
|
<file baseinstalldir="/" md5sum="358c628b2627319e40fd7e5092f19872" name="v8js_array_access.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="7baf3fe5b77d1374b39a1d8332e05df4" name="v8js_array_access.h" role="src" />
|
<file baseinstalldir="/" md5sum="7baf3fe5b77d1374b39a1d8332e05df4" name="v8js_array_access.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="6c213918edf4f46ac630498e92bb99f6" name="v8js_class.cc" role="src" />
|
<file baseinstalldir="/" md5sum="aa4bae42383773d1f769f44e0a28e484" name="v8js_class.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="444a6fda6259076cd2a419cf59ab2c42" name="v8js_class.h" role="src" />
|
<file baseinstalldir="/" md5sum="444a6fda6259076cd2a419cf59ab2c42" name="v8js_class.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="88b49988a5ef55edbd7ba085e7857f64" name="v8js_commonjs.cc" role="src" />
|
<file baseinstalldir="/" md5sum="88b49988a5ef55edbd7ba085e7857f64" name="v8js_commonjs.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="32a5d1a65f64ec37ec294f496fc11ff1" name="v8js_commonjs.h" role="src" />
|
<file baseinstalldir="/" md5sum="32a5d1a65f64ec37ec294f496fc11ff1" name="v8js_commonjs.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="c061344705c42fb705bffb2959fc1001" name="v8js_convert.cc" role="src" />
|
<file baseinstalldir="/" md5sum="c061344705c42fb705bffb2959fc1001" name="v8js_convert.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="ede2cf80141b1831c7e7ab50dc57236f" name="v8js_debug.cc" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="cbdb6ed29c9ece278aa2aeab75dbe61f" name="v8js_debug.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="40b66c44650a8127618c7fc48bf4b0b2" name="v8js_exceptions.cc" role="src" />
|
<file baseinstalldir="/" md5sum="40b66c44650a8127618c7fc48bf4b0b2" name="v8js_exceptions.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="9d13bf5f413c2d76664670e847e1a801" name="v8js_exceptions.h" role="src" />
|
<file baseinstalldir="/" md5sum="9d13bf5f413c2d76664670e847e1a801" name="v8js_exceptions.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="9f3ad8c136cdc3ebc2bdf993491f9ad8" name="v8js_methods.cc" role="src" />
|
<file baseinstalldir="/" md5sum="9f3ad8c136cdc3ebc2bdf993491f9ad8" name="v8js_methods.cc" role="src" />
|
||||||
@ -202,7 +200,7 @@
|
|||||||
<file baseinstalldir="/" md5sum="281fb591fbebc3d23e04196cdb3ec64a" name="v8js_object_export.h" role="src" />
|
<file baseinstalldir="/" md5sum="281fb591fbebc3d23e04196cdb3ec64a" name="v8js_object_export.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="d96c0e1eeaf1693813236f7e5da61e09" name="v8js_timer.cc" role="src" />
|
<file baseinstalldir="/" md5sum="d96c0e1eeaf1693813236f7e5da61e09" name="v8js_timer.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="49f609c8cea6033f2ad1e6c9c829a571" name="v8js_timer.h" role="src" />
|
<file baseinstalldir="/" md5sum="49f609c8cea6033f2ad1e6c9c829a571" name="v8js_timer.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="b3ba6b76f92683c55b45bce351af887e" name="v8js_v8.cc" role="src" />
|
<file baseinstalldir="/" md5sum="6cde5b068dfce9026a3b43c5232d6b1c" name="v8js_v8.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="0c4829d52ff46116c381b1b66ec27541" name="v8js_v8.h" role="src" />
|
<file baseinstalldir="/" md5sum="0c4829d52ff46116c381b1b66ec27541" name="v8js_v8.h" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="82908f4e741755efa2aedfb486945a40" name="v8js_v8object_class.cc" role="src" />
|
<file baseinstalldir="/" md5sum="82908f4e741755efa2aedfb486945a40" name="v8js_v8object_class.cc" role="src" />
|
||||||
<file baseinstalldir="/" md5sum="8a80d71ff40dfa833d3b58ac94475a9f" name="v8js_v8object_class.h" role="src" />
|
<file baseinstalldir="/" md5sum="8a80d71ff40dfa833d3b58ac94475a9f" name="v8js_v8object_class.h" role="src" />
|
||||||
@ -427,5 +425,21 @@
|
|||||||
- Fix reference counting issue on PHP->JS->PHP exception propagation
|
- Fix reference counting issue on PHP->JS->PHP exception propagation
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
|
<release>
|
||||||
|
<version>
|
||||||
|
<release>0.3.0</release>
|
||||||
|
<api>0.3.0</api>
|
||||||
|
</version>
|
||||||
|
<stability>
|
||||||
|
<release>stable</release>
|
||||||
|
<api>stable</api>
|
||||||
|
</stability>
|
||||||
|
<date>2015-10-11</date>
|
||||||
|
<license uri="http://www.php.net/license">The MIT License (MIT)</license>
|
||||||
|
<notes>
|
||||||
|
- Fix multi-threading with pthreads extension
|
||||||
|
- Remove v8 debug agent support (which is unsupported by V8 since 3.28.4)
|
||||||
|
</notes>
|
||||||
|
</release>
|
||||||
</changelog>
|
</changelog>
|
||||||
</package>
|
</package>
|
||||||
|
@ -52,7 +52,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* V8Js Version */
|
/* V8Js Version */
|
||||||
#define PHP_V8JS_VERSION "0.2.6"
|
#define PHP_V8JS_VERSION "0.3.0"
|
||||||
|
|
||||||
/* Hidden field name used to link JS wrappers with underlying PHP object */
|
/* Hidden field name used to link JS wrappers with underlying PHP object */
|
||||||
#define PHPJS_OBJECT_KEY "phpjs::object"
|
#define PHPJS_OBJECT_KEY "phpjs::object"
|
||||||
|
29
tests/function_properties.phpt
Normal file
29
tests/function_properties.phpt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
--TEST--
|
||||||
|
Test V8::executeString() : Set property on function
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$v8 = new V8Js();
|
||||||
|
|
||||||
|
$JS = <<< EOT
|
||||||
|
(function(exports) {
|
||||||
|
// begin module code
|
||||||
|
exports.hello = function() { return 'hello'; };
|
||||||
|
// end module code
|
||||||
|
return exports;
|
||||||
|
})({})
|
||||||
|
EOT;
|
||||||
|
|
||||||
|
$exports = $v8->executeString($JS, 'basic.js');
|
||||||
|
$exports->hello->foo = "bar";
|
||||||
|
$v8->func = $exports->hello;
|
||||||
|
|
||||||
|
$v8->executeString('print(PHP.func.foo + "\n");');
|
||||||
|
|
||||||
|
?>
|
||||||
|
===EOF===
|
||||||
|
--EXPECT--
|
||||||
|
bar
|
||||||
|
===EOF===
|
@ -138,7 +138,7 @@ static void v8js_dumper(v8::Isolate *isolate, v8::Local<v8::Value> var, int leve
|
|||||||
V8JS_GET_CLASS_NAME(cname, object);
|
V8JS_GET_CLASS_NAME(cname, object);
|
||||||
int hash = object->GetIdentityHash();
|
int hash = object->GetIdentityHash();
|
||||||
|
|
||||||
if (var->IsFunction())
|
if (var->IsFunction() && strcmp(ToCString(cname), "Closure") != 0)
|
||||||
{
|
{
|
||||||
v8::String::Utf8Value csource(object->ToString());
|
v8::String::Utf8Value csource(object->ToString());
|
||||||
php_printf("object(Closure)#%d {\n%*c%s\n", hash, level * 2 + 2, ' ', ToCString(csource));
|
php_printf("object(Closure)#%d {\n%*c%s\n", hash, level * 2 + 2, ' ', ToCString(csource));
|
||||||
|
@ -63,7 +63,7 @@ static int v8js_v8object_has_property(zval *object, zval *member, int has_set_ex
|
|||||||
V8JS_CTX_PROLOGUE_EX(obj->ctx, retval);
|
V8JS_CTX_PROLOGUE_EX(obj->ctx, retval);
|
||||||
v8::Local<v8::Value> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
v8::Local<v8::Value> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
||||||
|
|
||||||
if (Z_TYPE_P(member) == IS_STRING && v8obj->IsObject() && !v8obj->IsFunction())
|
if (Z_TYPE_P(member) == IS_STRING && v8obj->IsObject())
|
||||||
{
|
{
|
||||||
|
|
||||||
v8::Local<v8::Object> jsObj = v8obj->ToObject();
|
v8::Local<v8::Object> jsObj = v8obj->ToObject();
|
||||||
@ -122,7 +122,7 @@ static zval *v8js_v8object_read_property(zval *object, zval *member, int type, v
|
|||||||
V8JS_CTX_PROLOGUE_EX(obj->ctx, retval);
|
V8JS_CTX_PROLOGUE_EX(obj->ctx, retval);
|
||||||
v8::Local<v8::Value> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
v8::Local<v8::Value> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
||||||
|
|
||||||
if (Z_TYPE_P(member) == IS_STRING && v8obj->IsObject() && !v8obj->IsFunction())
|
if (Z_TYPE_P(member) == IS_STRING && v8obj->IsObject())
|
||||||
{
|
{
|
||||||
|
|
||||||
v8::Local<v8::Object> jsObj = v8obj->ToObject();
|
v8::Local<v8::Object> jsObj = v8obj->ToObject();
|
||||||
@ -156,7 +156,7 @@ static void v8js_v8object_write_property(zval *object, zval *member, zval *value
|
|||||||
V8JS_CTX_PROLOGUE(obj->ctx);
|
V8JS_CTX_PROLOGUE(obj->ctx);
|
||||||
v8::Local<v8::Value> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
v8::Local<v8::Value> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
||||||
|
|
||||||
if (v8obj->IsObject() && !v8obj->IsFunction()) {
|
if (v8obj->IsObject()) {
|
||||||
v8obj->ToObject()->ForceSet(V8JS_SYML(Z_STRVAL_P(member), Z_STRLEN_P(member)), zval_to_v8js(value, isolate TSRMLS_CC));
|
v8obj->ToObject()->ForceSet(V8JS_SYML(Z_STRVAL_P(member), Z_STRLEN_P(member)), zval_to_v8js(value, isolate TSRMLS_CC));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ static void v8js_v8object_unset_property(zval *object, zval *member, void **cach
|
|||||||
V8JS_CTX_PROLOGUE(obj->ctx);
|
V8JS_CTX_PROLOGUE(obj->ctx);
|
||||||
v8::Local<v8::Value> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
v8::Local<v8::Value> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
||||||
|
|
||||||
if (v8obj->IsObject() && !v8obj->IsFunction()) {
|
if (v8obj->IsObject()) {
|
||||||
v8obj->ToObject()->Delete(V8JS_SYML(Z_STRVAL_P(member), Z_STRLEN_P(member)));
|
v8obj->ToObject()->Delete(V8JS_SYML(Z_STRVAL_P(member), Z_STRLEN_P(member)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user