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

Commit 6dfe11f

Browse files
committed
Bump required v8 version to 6.6.313, closes #93
1 parent b4f92e0 commit 6dfe11f

14 files changed

+41
-28
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.275 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: 1 addition & 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.275
2323

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

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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@
66

77
using namespace v8;
88

9-
void weak_callback(const v8::WeakCallbackInfo<v8::Persistent<v8::String>>& data) {
10-
printf("Weak callback called\n");
11-
data.GetParameter()->Reset();
12-
// data.GetIsolate()->AdjustAmountOfExternalAllocatedMemory(-(1024*1024*1024));
13-
}
14-
159
int main(int argc, char* argv[]) {
1610
// Initialize V8.
17-
v8::V8::InitializeICU();
11+
//v8::V8::InitializeICU();
1812

1913
std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform();
2014
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_proxy.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ static PHP_METHOD(Proxy, getTarget) {
6767
PHP_V8_ENTER_STORED_ISOLATE(php_v8_value);
6868
PHP_V8_ENTER_STORED_CONTEXT(php_v8_value);
6969

70-
v8::Local<v8::Object> local_target = php_v8_value_get_local_as<v8::Proxy>(php_v8_value)->GetTarget();
70+
v8::Local<v8::Value> local_target = php_v8_value_get_local_as<v8::Proxy>(php_v8_value)->GetTarget();
71+
72+
PHP_V8_THROW_VALUE_EXCEPTION_WHEN_UNDEFINED(local_target, "Failed to get Proxy target"); // this should never happen
73+
74+
if (local_target->IsNull()) {
75+
RETURN_NULL();
76+
}
7177

7278
php_v8_get_or_create_value(return_value, local_target, php_v8_value->php_v8_isolate);
7379
}
@@ -83,7 +89,10 @@ static PHP_METHOD(Proxy, getHandler) {
8389

8490
v8::Local<v8::Value> local_handler = php_v8_value_get_local_as<v8::Proxy>(php_v8_value)->GetHandler();
8591

86-
if (local_handler->IsUndefined()) {
92+
// this should never happen
93+
PHP_V8_THROW_VALUE_EXCEPTION_WHEN_UNDEFINED(local_handler, "Failed to get Proxy handler"); // this should never happen
94+
95+
if (local_handler->IsNull()) {
8796
RETURN_NULL();
8897
}
8998

@@ -121,10 +130,10 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2)
121130
ZEND_ARG_OBJ_INFO(0, handler, V8\\ObjectValue, 0)
122131
ZEND_END_ARG_INFO()
123132

124-
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getTarget, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 0)
133+
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getTarget, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 1)
125134
ZEND_END_ARG_INFO()
126135

127-
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getHandler, ZEND_RETURN_VALUE, 0, V8\\Value, 0)
136+
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getHandler, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 1)
128137
ZEND_END_ARG_INFO()
129138

130139
PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_isRevoked, ZEND_RETURN_VALUE, 0, _IS_BOOL, 0)

0 commit comments

Comments
 (0)