0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 12:51:52 +00:00

Initialize ICU as (meanwhile) needed

This commit is contained in:
Stefan Siegl 2017-04-14 14:27:01 +02:00
parent 5cf93a2970
commit c957be8b2a
No known key found for this signature in database
GPG Key ID: 51575950154839CD
3 changed files with 26 additions and 1 deletions

View File

@ -3,7 +3,7 @@ PHP_ARG_WITH(v8js, for V8 Javascript Engine,
if test "$PHP_V8JS" != "no"; then
SEARCH_PATH="/usr/local /usr"
SEARCH_FOR="include/v8.h"
SEARCH_FOR="$PHP_LIBDIR/libv8.$SHLIB_DL_SUFFIX_NAME"
if test -r $PHP_V8JS/$SEARCH_FOR; then
case $host_os in
@ -25,6 +25,8 @@ if test "$PHP_V8JS" != "no"; then
done
fi
AC_DEFINE_UNQUOTED([PHP_V8_EXEC_PATH], "$V8_DIR/$SEARCH_FOR", [Full path to libv8 library file])
if test -z "$V8_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the v8 distribution])

View File

@ -0,0 +1,18 @@
--TEST--
Test V8::executeString() : Issue #306 V8 crashing on toLocaleString()
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$v8 = new V8Js();
$v8 = new V8Js;
$expr = 'new Date("10/11/2009").toLocaleString("en-us", { month: "long" });';
var_dump( $v8->executeString($expr, null, V8Js::FLAG_FORCE_ARRAY) );
?>
===EOF===
--EXPECT--
string(7) "October"
===EOF===

View File

@ -76,6 +76,11 @@ void v8js_v8_init() /* {{{ */
}
}
#ifdef PHP_V8_EXEC_PATH
/* Initialize ICU */
v8::V8::InitializeICUDefaultLocation(PHP_V8_EXEC_PATH, nullptr);
#endif
/* Initialize V8 */
v8::V8::Initialize();