Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 5d7c3e4

Browse files
authored
Merge pull request #100 from pinepain/bump-v8
Bump v8 version
2 parents b4f92e0 + 45e0cf7 commit 5d7c3e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+735
-886
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66

77
env:
88
global:
9-
- V8=6.5.144
9+
- V8=6.6.313
1010
matrix:
1111
- PHP=7.2
1212
- PHP=7.2 TEST_PHP_ARGS=-m

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project(php-v8)
33

44
# NOTE: This CMake file is just for syntax highlighting in CLion
55

6-
include_directories(/usr/local/opt/v8@6.5/include)
7-
include_directories(/usr/local/opt/v8@6.5/include/libplatform)
6+
include_directories(/usr/local/opt/v8@6.6/include)
7+
include_directories(/usr/local/opt/v8@6.6/include/libplatform)
88

99
include_directories(/usr/local/include/php)
1010
include_directories(/usr/local/include/php/TSRM)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ on top of php-v8 extension and makes embedding JavaScript in PHP easier.
100100
### Requirements
101101

102102
#### V8
103-
You will need a recent v8 Google JavaScript engine version installed. At this time v8 >= 6.5.144 required.
103+
You will need a recent v8 Google JavaScript engine version installed. At this time v8 >= 6.6.313 required.
104104

105105
#### PHP
106106
This extension is PHP7-only. It works and tested with both PHP 7.0 and PHP 7.1.

config.m4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if test "$PHP_V8" != "no"; then
1919
SEARCH_PATH="/usr/local /usr"
2020
SEARCH_FOR="include/v8.h"
2121

22-
V8_MIN_API_VERSION_STR=6.5.144
22+
V8_MIN_API_VERSION_STR=6.6.313
2323

2424
DESIRED_V8_VERSION=`echo "${V8_MIN_API_VERSION_STR}" | $AWK 'BEGIN { FS = "."; } { printf "%s.%s", [$]1, [$]2;}'`
2525

@@ -204,6 +204,7 @@ if test "$PHP_V8" != "no"; then
204204
src/php_v8_date.cc \
205205
src/php_v8_regexp.cc \
206206
src/php_v8_promise.cc \
207+
src/php_v8_promise_resolver.cc \
207208
src/php_v8_proxy.cc \
208209
src/php_v8_number_object.cc \
209210
src/php_v8_boolean_object.cc \

scripts/provision/provision.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ echo Provisioning...
55
# Add Ondřej Surý's PPA with co-installable PHP versions:
66
sudo add-apt-repository -y ppa:ondrej/php
77
# Add libv8 PPA:
8-
sudo add-apt-repository ppa:pinepain/libv8-6.5
8+
sudo add-apt-repository ppa:pinepain/libv8-6.6
99

1010
# Let's update packages list:
1111
sudo apt-get update
@@ -19,7 +19,7 @@ sudo apt-get install -y git htop curl pkgconf
1919

2020

2121
# Build and development requirements
22-
sudo apt-get install -y libv8-6.5 libv8-6.5-dev libv8-6.5-dbg
22+
sudo apt-get install -y libv8-6.6 libv8-6.6-dev libv8-6.6-dbg
2323
sudo apt-get install -y dh-make valgrind
2424
sudo apt-get install -y libssl-dev openssl
2525
sudo apt-get install -y php7.2 php7.2-cli php7.2-dev php7.2-fpm

scripts/test_v8/hello_world.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void weak_callback(const v8::WeakCallbackInfo<v8::Persistent<v8::String>>& data)
1414

1515
int main(int argc, char* argv[]) {
1616
// Initialize V8.
17-
v8::V8::InitializeICU();
17+
//v8::V8::InitializeICU();
1818

1919
std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform();
2020
v8::V8::InitializePlatform(platform.get());

scripts/test_v8/hello_world_build_deb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
ROOT=/opt/libv8-6.5
3+
ROOT=/opt/libv8-6.6
44
LIB_DIR=$ROOT/lib/
55

66
SRC_DIR=$ROOT

scripts/test_v8/hello_world_build_osx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
ROOT=/usr/local/opt/v8@6.5
3+
ROOT=/usr/local/opt/v8@6.6
44
LIB_DIR=$ROOT/lib/
55

66
SRC_DIR=$ROOT

src/php_v8_exceptions.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,15 @@ extern void php_v8_throw_try_catch_exception(php_v8_context_t *php_v8_context, v
8181
return; \
8282
}
8383

84+
#define PHP_V8_THROW_EXCEPTION_WHEN_UNDEFINED_CE(value, message, ce) \
85+
if ((value)->IsUndefined()) { \
86+
PHP_V8_THROW_EXCEPTION_CE(message, ce); \
87+
return; \
88+
}
89+
8490
#define PHP_V8_THROW_VALUE_EXCEPTION_WHEN_NOTHING(value, message) PHP_V8_THROW_EXCEPTION_WHEN_NOTHING_CE((value), (message), php_v8_value_exception_class_entry)
8591
#define PHP_V8_THROW_VALUE_EXCEPTION_WHEN_EMPTY(value, message) PHP_V8_THROW_EXCEPTION_WHEN_EMPTY_CE((value), (message), php_v8_value_exception_class_entry)
92+
#define PHP_V8_THROW_VALUE_EXCEPTION_WHEN_UNDEFINED(value, message) PHP_V8_THROW_EXCEPTION_WHEN_UNDEFINED_CE((value), (message), php_v8_value_exception_class_entry)
8693

8794

8895
#define PHP_V8_THROW_EXCEPTION_WHEN_NOTHING(value, message) \
@@ -97,6 +104,7 @@ extern void php_v8_throw_try_catch_exception(php_v8_context_t *php_v8_context, v
97104
return; \
98105
}
99106

107+
100108
#define PHP_V8_THROW_EXCEPTION_WHEN_LIMITS_HIT(php_v8_context) \
101109
if ((php_v8_context)->php_v8_isolate->limits.time_limit_hit || (php_v8_context)->php_v8_isolate->limits.memory_limit_hit) { \
102110
php_v8_throw_try_catch_exception((php_v8_context), NULL); \

src/php_v8_object.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,14 +614,17 @@ static PHP_METHOD(Object, getPropertyNames) {
614614
zend_long mode = static_cast<zend_long>(v8::KeyCollectionMode::kOwnOnly);
615615
zend_long property_filter = static_cast<zend_long>(v8::PropertyFilter::ALL_PROPERTIES);
616616
zend_long index_filter = static_cast<zend_long>(v8::IndexFilter::kIncludeIndices);
617+
zend_bool convert_to_strings = '\0';
617618

618-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|lll", &context_zv, &mode, &property_filter, &index_filter) == FAILURE) {
619+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|lllb",
620+
&context_zv, &mode, &property_filter, &index_filter, &convert_to_strings) == FAILURE) {
619621
return;
620622
}
621623

622624
mode = mode ? mode & PHP_V8_KEY_COLLECTION_MODE_FLAGS : mode;
623625
property_filter = property_filter ? property_filter & PHP_V8_PROPERTY_FILTER_FLAGS : property_filter;
624626
index_filter = index_filter ? index_filter & PHP_V8_INDEX_FILTER_FLAGS : index_filter;
627+
v8::KeyConversionMode key_conversion = convert_to_strings ? v8::KeyConversionMode::kConvertToString : v8::KeyConversionMode::kKeepNumbers;
625628

626629
PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value);
627630
PHP_V8_CONTEXT_FETCH_WITH_CHECK(context_zv, php_v8_context);
@@ -639,7 +642,8 @@ static PHP_METHOD(Object, getPropertyNames) {
639642
v8::MaybeLocal<v8::Array> maybe_local_array = local_object->GetPropertyNames(context,
640643
static_cast<v8::KeyCollectionMode>(mode),
641644
static_cast<v8::PropertyFilter >(property_filter),
642-
static_cast<v8::IndexFilter>(index_filter));
645+
static_cast<v8::IndexFilter>(index_filter),
646+
key_conversion);
643647

644648
PHP_V8_MAYBE_CATCH(php_v8_context, try_catch);
645649
PHP_V8_THROW_EXCEPTION_WHEN_EMPTY(maybe_local_array, "Failed to get property names")
@@ -652,11 +656,13 @@ static PHP_METHOD(Object, getPropertyNames) {
652656
static PHP_METHOD(Object, getOwnPropertyNames) {
653657
zval *context_zv;
654658
zend_long filter = static_cast<zend_long>(v8::PropertyFilter::ALL_PROPERTIES);
659+
zend_bool convert_to_strings = '\0';
655660

656-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|l", &context_zv, &filter) == FAILURE) {
661+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|lb", &context_zv, &filter, &convert_to_strings) == FAILURE) {
657662
return;
658663
}
659664
filter = filter ? filter & PHP_V8_PROPERTY_FILTER_FLAGS : filter;
665+
v8::KeyConversionMode key_conversion = convert_to_strings ? v8::KeyConversionMode::kConvertToString : v8::KeyConversionMode::kKeepNumbers;
660666

661667
PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value);
662668
PHP_V8_CONTEXT_FETCH_WITH_CHECK(context_zv, php_v8_context);
@@ -671,7 +677,7 @@ static PHP_METHOD(Object, getOwnPropertyNames) {
671677
PHP_V8_TRY_CATCH(isolate);
672678
PHP_V8_INIT_ISOLATE_LIMITS_ON_OBJECT_VALUE(php_v8_value);
673679

674-
v8::MaybeLocal<v8::Array> maybe_local_array = local_object->GetOwnPropertyNames(context, static_cast<v8::PropertyFilter >(filter));
680+
v8::MaybeLocal<v8::Array> maybe_local_array = local_object->GetOwnPropertyNames(context, static_cast<v8::PropertyFilter >(filter), key_conversion);
675681

676682
PHP_V8_MAYBE_CATCH(php_v8_context, try_catch);
677683
PHP_V8_THROW_EXCEPTION_WHEN_EMPTY(maybe_local_array, "Failed to get own property names")
@@ -1372,11 +1378,13 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getPropertyNames, ZEND_RET
13721378
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
13731379
ZEND_ARG_TYPE_INFO(0, property_filter, IS_LONG, 0)
13741380
ZEND_ARG_TYPE_INFO(0, index_filter, IS_LONG, 0)
1381+
ZEND_ARG_TYPE_INFO(0, convert_to_strings, _IS_BOOL, 0)
13751382
ZEND_END_ARG_INFO()
13761383

13771384
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getOwnPropertyNames, ZEND_RETURN_VALUE, 1, V8\\ArrayObject, 0)
13781385
ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0)
13791386
ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 0)
1387+
ZEND_ARG_TYPE_INFO(0, convert_to_strings, _IS_BOOL, 0)
13801388
ZEND_END_ARG_INFO()
13811389

13821390
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getPrototype, ZEND_RETURN_VALUE, 0, V8\\Value, 0)

0 commit comments

Comments
 (0)