From c2a2cc341f0e4c9e64f5d4e0cb264c85a2c0371d Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Wed, 6 Jan 2016 11:58:40 +0000 Subject: [PATCH] Initialize libv8_platform for Windows as well V8 doesn't work without libplatform anymore, even under Windows. Furthermore adapted two tests to \r\n vs. \n line ending differences --- config.w32 | 10 +++++++--- php_v8js_macros.h | 2 +- tests/fatal_error_rethrow.phpt | 2 +- tests/js-construct-protected-ctor.phpt | 2 +- v8js.cc | 2 +- v8js_v8.cc | 4 ++-- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/config.w32 b/config.w32 index df85c80..92b90ee 100644 --- a/config.w32 +++ b/config.w32 @@ -2,7 +2,11 @@ ARG_WITH("v8js", "for V8 Javascript Engine", "no"); if (PHP_V8JS != "no") { - if (CHECK_LIB("v8.lib", "v8js") && + if (CHECK_LIB("v8_libplatform.lib", "v8js") && + CHECK_LIB("v8_libbase.lib", "v8js") && + CHECK_LIB("winmm.lib", "v8js") && + + CHECK_LIB("v8.lib", "v8js") && CHECK_HEADER_ADD_INCLUDE("v8.h", "CFLAGS_V8JS")) { ADD_FLAG("CFLAGS_V8JS", "/EHcs"); @@ -10,8 +14,8 @@ if (PHP_V8JS != "no") { ADD_FLAG("CFLAGS_V8JS", "/D ZEND_WIN32_FORCE_INLINE"); ADD_FLAG("CFLAGS_V8JS", "/D __STDC_LIMIT_MACROS"); - AC_DEFINE("PHP_V8_API_VERSION", "3017015", "", false); - AC_DEFINE("PHP_V8_VERSION", "3.17.15", "", true); + AC_DEFINE("PHP_V8_API_VERSION", "4007075", "", false); + AC_DEFINE("PHP_V8_VERSION", "4.7.75", "", true); EXTENSION("v8js", "v8js_array_access.cc v8js.cc v8js_class.cc v8js_commonjs.cc v8js_convert.cc v8js_exceptions.cc v8js_methods.cc v8js_object_export.cc v8js_timer.cc v8js_v8.cc v8js_v8object_class.cc v8js_variables.cc", "yes"); diff --git a/php_v8js_macros.h b/php_v8js_macros.h index fdc9100..0fb42c4 100644 --- a/php_v8js_macros.h +++ b/php_v8js_macros.h @@ -146,7 +146,7 @@ struct _v8js_process_globals { /* V8 command line flags */ char *v8_flags; -#if !defined(_WIN32) && PHP_V8_API_VERSION >= 3029036 +#if PHP_V8_API_VERSION >= 3029036 v8::Platform *v8_platform; #endif }; diff --git a/tests/fatal_error_rethrow.phpt b/tests/fatal_error_rethrow.phpt index 2f9d80a..4459432 100644 --- a/tests/fatal_error_rethrow.phpt +++ b/tests/fatal_error_rethrow.phpt @@ -27,6 +27,6 @@ Fatal error: Uncaught Error: Call to a member function bar() on %s in %s%efatal_ Stack trace: #0 [internal function]: {closure}() #1 [internal function]: Closure->__invoke() -#2 %s%efatal_error_rethrow.php(16): V8Js->executeString('\nPHP.foo();\n') +#2 %s%efatal_error_rethrow.php(16): V8Js->executeString(%s) #3 {main} thrown in %s%efatal_error_rethrow.php on line 7 diff --git a/tests/js-construct-protected-ctor.phpt b/tests/js-construct-protected-ctor.phpt index 7b379a1..9af79b4 100644 --- a/tests/js-construct-protected-ctor.phpt +++ b/tests/js-construct-protected-ctor.phpt @@ -70,7 +70,7 @@ object(V8JsScriptException)#%d (13) { ["args"]=> array(2) { [0]=> - string(109) " + string(%d) " PHP.greeter.sayHello(); var ngGreeter = new PHP.greeter.constructor("Ringo"); diff --git a/v8js.cc b/v8js.cc index 3a50a31..66c95c3 100644 --- a/v8js.cc +++ b/v8js.cc @@ -153,7 +153,7 @@ static PHP_MSHUTDOWN_FUNCTION(v8js) if(v8_initialized) { v8::V8::Dispose(); -#if !defined(_WIN32) && PHP_V8_API_VERSION >= 3029036 +#if PHP_V8_API_VERSION >= 3029036 v8::V8::ShutdownPlatform(); // @fixme call virtual destructor somehow //delete v8js_process_globals.v8_platform; diff --git a/v8js_v8.cc b/v8js_v8.cc index 12d3f4c..35d4617 100644 --- a/v8js_v8.cc +++ b/v8js_v8.cc @@ -29,7 +29,7 @@ extern "C" { #include "zend_exceptions.h" } -#if !defined(_WIN32) && PHP_V8_API_VERSION >= 3029036 +#if PHP_V8_API_VERSION >= 3029036 #include #endif @@ -53,7 +53,7 @@ void v8js_v8_init(TSRMLS_D) /* {{{ */ } #endif -#if !defined(_WIN32) && PHP_V8_API_VERSION >= 3029036 +#if PHP_V8_API_VERSION >= 3029036 v8js_process_globals.v8_platform = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(v8js_process_globals.v8_platform); #endif