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

Commit fb3482c

Browse files
authored
Merge pull request #50 from pinepain/update-to-v8-63
Upgrade to libv8-6.3
2 parents 67fa362 + 74ce3ed commit fb3482c

File tree

162 files changed

+413
-232
lines changed

Some content is hidden

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

162 files changed

+413
-232
lines changed

.travis.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,22 @@
1-
sudo: required
21
dist: trusty
2+
sudo: required
33

4-
language: php
5-
6-
php:
7-
- 7.1
8-
- nightly
9-
10-
matrix:
11-
allow_failures:
12-
- php: nightly
4+
services:
5+
- docker
136

147
env:
158
global:
16-
- NO_INTERACTION=1
17-
- TEST_TIMEOUT=120
9+
- V8=6.3
1810
matrix:
19-
- V8=6.2
20-
- V8=6.2 TEST_PHP_ARGS=-m
11+
- TAG=xenial-v8-63-php-71
12+
- TAG=xenial-v8-63-php-71 TEST_PHP_ARGS=-m
13+
- TAG=xenial-v8-63-php-72
14+
- TAG=xenial-v8-63-php-72 TEST_PHP_ARGS=-m
2115

2216
before_install:
23-
- sudo add-apt-repository ppa:pinepain/libv8-${V8} -y
24-
- sudo apt-get update -q
25-
- sudo apt-get install -y libv8-${V8}-dev
26-
- php -i
27-
- php-config || true
28-
29-
before_script:
30-
- echo 'variables_order = "EGPCS"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
31-
- phpize && ./configure && make
17+
# docker on travis doesn't allow anything before FROM, let's fix that
18+
- sed -i -e "s/\${TAG}/$TAG/g" Dockerfile && sed -i -e '1,2d' Dockerfile
19+
- docker build -t ${TRAVIS_REPO_SLUG}:${V8}-${PHP} --build-arg TAG=${TAG} .
3220

3321
script:
34-
- sh -c "make test | tee result.txt"
35-
- sh test-report.sh
36-
37-
addons:
38-
apt:
39-
packages:
40-
- valgrind
22+
- docker run -e TEST_PHP_ARGS ${TRAVIS_REPO_SLUG}:${V8}-${PHP} bash -c "make test | tee result.txt; ./test-report.sh"

.valgrind-docker.supp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
<docker_specific_report>
3+
Memcheck:Free
4+
fun:free
5+
fun:deallocate
6+
fun:deallocate
7+
fun:_M_destroy
8+
fun:_M_dispose
9+
fun:~basic_string
10+
...
11+
}

.valgrind-v8.supp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
<suppress_false_positive_warning_see_v8_issue_6566>
3+
Memcheck:Cond
4+
fun:_ZN2v88internal20MarkCompactCollector20EmptyMarkingWorklistEv
5+
...
6+
}

.valgrindrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--gen-suppressions=all
2+
--suppressions=./.valgrind-v8.supp
3+
--suppressions=./.valgrind-docker.supp

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.2/include)
7-
include_directories(/usr/local/opt/v8@6.2/include/libplatform)
6+
include_directories(/usr/local/opt/v8@6.3/include)
7+
include_directories(/usr/local/opt/v8@6.3/include/libplatform)
88

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

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ARG TAG=xenial-v8-63-php-72
2+
3+
FROM pinepain/php-v8-docker:${TAG}
4+
5+
COPY . /root/php-v8
6+
COPY ./scripts/provision/.bashrc /root/.bashrc
7+
8+
WORKDIR /root/php-v8
9+
10+
RUN php -i && php-config || true
11+
12+
RUN phpize && ./configure && make

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ $source = new \V8\StringValue($isolate, "'Hello' + ', World!'");
4848
$script = new \V8\Script($context, $source);
4949
$result = $script->run($context);
5050

51-
echo $result->toString($context)->value(), PHP_EOL;
51+
echo $result->value(), PHP_EOL;
5252
```
5353

5454
which will output `Hello, World!`. See how it's shorter and more readable than [that C++ version][v8-hello-world]?
@@ -69,7 +69,7 @@ in your IDE and other code-analysis tools.
6969
### Requirements
7070

7171
#### V8
72-
You will need a recent v8 Google JavaScript engine version installed. At this time the extension is tested on 6.2.2.
72+
You will need a recent v8 Google JavaScript engine version installed. At this time v8 >= 6.3.2 required.
7373

7474
#### PHP
7575
This extension is PHP7-only. It works and tested with both PHP 7.0 and PHP 7.1.
@@ -92,7 +92,7 @@ $ php --ri v8
9292

9393
While [pinepain/php](https://launchpad.net/~pinepain/+archive/ubuntu/php) PPA targets to contain all necessary
9494
extensions with dependencies, you may find
95-
[pinepain/libv8-6.2](https://launchpad.net/~pinepain/+archive/ubuntu/libv8-6.2),
95+
[pinepain/libv8-6.3](https://launchpad.net/~pinepain/+archive/ubuntu/libv8-6.3),
9696
[pinepain/libv8-experimental](https://launchpad.net/~pinepain/+archive/ubuntu/libv8-experimental) and
9797
[pinepain/php-v8](https://launchpad.net/~pinepain/+archive/ubuntu/php-v8) standalone PPAs useful.
9898

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.2.2
22+
V8_MIN_API_VERSION_STR=6.3.2
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.2
8+
sudo add-apt-repository ppa:pinepain/libv8-6.3
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.2 libv8-6.2-dev libv8-6.2-dbg
22+
sudo apt-get install -y libv8-6.3 libv8-6.3-dev libv8-6.3-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.1 php7.1-cli php7.1-dev php7.1-fpm

scripts/test_v8/hello_world.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int main(int argc, char* argv[]) {
7878
Local<Value> result = script->Run();
7979

8080
// Convert the result to an UTF8 string and print it.
81-
String::Utf8Value utf8(result);
81+
String::Utf8Value utf8(isolate, result);
8282
printf("%s\n", *utf8);
8383
}
8484

src/php_v8_exceptions.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void php_v8_create_try_catch_exception(zval *return_value, php_v8_isolate_t *php
5252
const char *message = NULL;
5353

5454
PHP_V8_DECLARE_LIMITS(php_v8_isolate);
55+
PHP_V8_DECLARE_ISOLATE(php_v8_isolate);
5556

5657
if ((try_catch == NULL) || (try_catch->Exception()->IsNull() && try_catch->Message().IsEmpty() && !try_catch->CanContinue() && try_catch->HasTerminated())) {
5758
if (limits->time_limit_hit) {
@@ -68,10 +69,9 @@ void php_v8_create_try_catch_exception(zval *return_value, php_v8_isolate_t *php
6869
object_init_ex(return_value, ce);
6970
zend_update_property_string(php_v8_try_catch_exception_class_entry, return_value, ZEND_STRL("message"), message);
7071
} else {
71-
v8::String::Utf8Value exception(try_catch->Exception());
72-
7372
ce = php_v8_try_catch_exception_class_entry;
74-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK_NODECL(exception, message);
73+
74+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING_NODECL(isolate, message, try_catch->Exception());
7575

7676
object_init_ex(return_value, ce);
7777
zend_update_property_string(php_v8_try_catch_exception_class_entry, return_value, ZEND_STRL("message"), message);

src/php_v8_message.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,18 @@ void php_v8_message_create_from_message(zval *return_value, php_v8_isolate_t *ph
2929

3030
object_init_ex(return_value, this_ce);
3131

32-
v8::Isolate *isolate = php_v8_isolate->isolate;
32+
PHP_V8_DECLARE_ISOLATE(php_v8_isolate);
3333
v8::Local<v8::Context> context = isolate->GetEnteredContext();
3434

3535
/* v8::Message::Get */
3636
if (!message->Get().IsEmpty()) {
37-
v8::String::Utf8Value message_utf8(message->Get());
38-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(message_utf8, message_chars);
37+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, message_chars, message->Get());
3938
zend_update_property_string(this_ce, return_value, ZEND_STRL("message"), message_chars);
4039
}
4140

4241
/* v8::Message::GetSourceLine */
4342
if (!message->GetSourceLine(context).IsEmpty()) {
44-
v8::String::Utf8Value source_line_utf8(message->GetSourceLine(context).ToLocalChecked());
45-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(source_line_utf8, source_line_chars);
43+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, source_line_chars, message->GetSourceLine(context).ToLocalChecked());
4644
zend_update_property_string(this_ce, return_value, ZEND_STRL("source_line"), source_line_chars);
4745
}
4846

@@ -54,8 +52,7 @@ void php_v8_message_create_from_message(zval *return_value, php_v8_isolate_t *ph
5452

5553
/* v8::Message::GetScriptResourceName */
5654
if (!message->GetScriptResourceName().IsEmpty() && !message->GetScriptResourceName()->IsUndefined()) {
57-
v8::String::Utf8Value script_resource_name_utf8(message->GetScriptResourceName());
58-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(script_resource_name_utf8, script_resource_name_chars);
55+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, script_resource_name_chars, message->GetScriptResourceName());
5956
zend_update_property_string(this_ce, return_value, ZEND_STRL("resource_name"), script_resource_name_chars);
6057
}
6158

src/php_v8_object.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ static PHP_METHOD(Object, setAccessor) {
447447
v8::Local<v8::Object> local_object = php_v8_value_get_local_as<v8::Object>(php_v8_value);
448448
v8::Local<v8::Name> local_name = php_v8_value_get_local_as<v8::Name>(php_v8_name);
449449

450-
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(name, local_name);
450+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, name, local_name);
451451

452452
attributes = attributes ? attributes & PHP_V8_PROPERTY_ATTRIBUTE_FLAGS : attributes;
453453
settings = settings ? settings & PHP_V8_ACCESS_CONTROL_FLAGS : settings;
@@ -574,7 +574,7 @@ static PHP_METHOD(Object, setNativeDataProperty) {
574574
v8::Local<v8::Object> local_object = php_v8_value_get_local_as<v8::Object>(php_v8_value);
575575
v8::Local<v8::Name> local_name = php_v8_value_get_local_as<v8::Name>(php_v8_name);
576576

577-
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(name, local_name);
577+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, name, local_name);
578578

579579
attributes = attributes ? attributes & PHP_V8_PROPERTY_ATTRIBUTE_FLAGS : attributes;
580580

src/php_v8_object_template.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static PHP_METHOD(ObjectTemplate, setAccessor) {
245245

246246
v8::Local<v8::Name> local_name = php_v8_value_get_local_as<v8::Name>(php_v8_name);
247247

248-
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(name, local_name);
248+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, name, local_name);
249249

250250
v8::AccessorNameGetterCallback getter;
251251
v8::AccessorNameSetterCallback setter = 0;

src/php_v8_script_origin.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ extern void php_v8_create_script_origin(zval *return_value, v8::Local<v8::Contex
2727
zval options_zv;
2828

2929
object_init_ex(return_value, this_ce);
30+
v8::Isolate *isolate= context->GetIsolate();
3031

3132
/* v8::ScriptOrigin::ResourceName */
3233
if (!origin.ResourceName().IsEmpty() && !origin.ResourceName()->IsUndefined()) {
33-
v8::String::Utf8Value resource_name_utf8(origin.ResourceName());
34-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(resource_name_utf8, resource_name_chars);
34+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, resource_name_chars, origin.ResourceName());
3535
zend_update_property_string(this_ce, return_value, ZEND_STRL("resource_name"), resource_name_chars);
3636
}
3737

@@ -57,8 +57,7 @@ extern void php_v8_create_script_origin(zval *return_value, v8::Local<v8::Contex
5757

5858
/* v8::SourceMapUrl::ResourceName */
5959
if (!origin.SourceMapUrl().IsEmpty() && !origin.SourceMapUrl()->IsUndefined()) {
60-
v8::String::Utf8Value source_map_url_utf8(origin.SourceMapUrl());
61-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(source_map_url_utf8, source_map_url_chars);
60+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, source_map_url_chars, origin.SourceMapUrl());
6261
zend_update_property_string(this_ce, return_value, ZEND_STRL("source_map_url"), source_map_url_chars);
6362
}
6463
}

src/php_v8_stack_frame.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ zend_class_entry *php_v8_stack_frame_class_entry;
2222
#define this_ce php_v8_stack_frame_class_entry
2323

2424

25-
void php_v8_stack_frame_create_from_stack_frame(zval *return_value, v8::Local<v8::StackFrame> frame) {
25+
void php_v8_stack_frame_create_from_stack_frame(v8::Isolate *isolate, zval *return_value, v8::Local<v8::StackFrame> frame) {
2626

2727
assert(!frame.IsEmpty());
2828

@@ -41,23 +41,19 @@ void php_v8_stack_frame_create_from_stack_frame(zval *return_value, v8::Local<v8
4141

4242
/* v8::StackFrame::GetScriptName */
4343
if (!frame->GetScriptName().IsEmpty()) {
44-
v8::String::Utf8Value script_name_utf8(frame->GetScriptName());
45-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(script_name_utf8, script_name_chars);
44+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, script_name_chars, frame->GetScriptName());
4645
zend_update_property_string(this_ce, return_value, ZEND_STRL("script_name"), script_name_chars);
4746
}
4847

4948
/* v8::StackFrame::GetScriptNameOrSourceURL */
5049
if (!frame->GetScriptNameOrSourceURL().IsEmpty()) {
51-
v8::String::Utf8Value script_name_or_source_url_utf8(frame->GetScriptNameOrSourceURL());
52-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(script_name_or_source_url_utf8, script_name_or_source_url_chars);
53-
zend_update_property_string(this_ce, return_value, ZEND_STRL("script_name_or_source_url"),
54-
script_name_or_source_url_chars);
50+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, script_name_or_source_url_chars, frame->GetScriptNameOrSourceURL());
51+
zend_update_property_string(this_ce, return_value, ZEND_STRL("script_name_or_source_url"), script_name_or_source_url_chars);
5552
}
5653

5754
/* v8::StackFrame::GetFunctionName */
5855
if (!frame->GetFunctionName().IsEmpty()) {
59-
v8::String::Utf8Value function_name_utf8(frame->GetFunctionName());
60-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(function_name_utf8, function_name_chars);
56+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, function_name_chars, frame->GetFunctionName());
6157
zend_update_property_string(this_ce, return_value, ZEND_STRL("function_name"), function_name_chars);
6258
}
6359

src/php_v8_stack_frame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern "C" {
2525

2626
extern zend_class_entry* php_v8_stack_frame_class_entry;
2727

28-
extern void php_v8_stack_frame_create_from_stack_frame(zval *return_value, v8::Local<v8::StackFrame> frame);
28+
extern void php_v8_stack_frame_create_from_stack_frame(v8::Isolate *isolate, zval *return_value, v8::Local<v8::StackFrame> frame);
2929

3030

3131
PHP_MINIT_FUNCTION(php_v8_stack_frame);

src/php_v8_stack_trace.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void php_v8_stack_trace_create_from_stack_trace(zval *return_value, php_v8_isola
2929

3030
object_init_ex(return_value, this_ce);
3131

32-
v8::Isolate *isolate = php_v8_isolate->isolate;
32+
PHP_V8_DECLARE_ISOLATE(php_v8_isolate);
3333

3434
/* v8::StackTrace::GetFrames */
3535
/* v8::StackTrace::GetFrame */
@@ -42,7 +42,7 @@ void php_v8_stack_trace_create_from_stack_trace(zval *return_value, php_v8_isola
4242
zval frame_zv;
4343

4444
for (uint32_t i = 0; i < frames_cnt; i++) {
45-
php_v8_stack_frame_create_from_stack_frame(&frame_zv, trace->GetFrame(i));
45+
php_v8_stack_frame_create_from_stack_frame(isolate, &frame_zv, trace->GetFrame(i));
4646
add_index_zval(&frames_array_zv, i, &frame_zv);
4747
}
4848

src/php_v8_string.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static PHP_METHOD(String, value)
5959

6060
v8::Local<v8::Value> str_tpl = php_v8_value_get_local(php_v8_value);
6161

62-
v8::String::Utf8Value str(str_tpl);
62+
v8::String::Utf8Value str(isolate, str_tpl);
6363

6464
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(str, cstr);
6565

src/php_v8_symbol.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static PHP_METHOD(Symbol, value)
6969
RETURN_EMPTY_STRING();
7070
}
7171

72-
v8::String::Utf8Value str(local_name);
72+
v8::String::Utf8Value str(isolate, local_name);
7373

7474
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(str, cstr);
7575

src/php_v8_template.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void php_v8_template_SetNativeDataProperty(v8::Isolate *isolate, v8::Local<T> lo
261261

262262
v8::Local<v8::Name> local_name = php_v8_value_get_local_as<v8::Name>(php_v8_name);
263263

264-
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(name, local_name);
264+
PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, name, local_name);
265265

266266
phpv8::CallbacksBucket *bucket = php_v8_template->persistent_data->bucket("native_data_property_", local_name->IsSymbol(), name);
267267
data = v8::External::New(isolate, bucket);

src/php_v8_value.h

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,13 @@ extern php_v8_value_t *php_v8_get_or_create_value(zval *return_value, v8::Local<
8787
return; \
8888
}
8989

90-
#define PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(cstr, v8_local_string_from) \
91-
v8::String::Utf8Value _v8_utf8_str_##cstr((v8_local_string_from)); \
92-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(_v8_utf8_str_##cstr, cstr); \
90+
#define PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING(isolate, cstr, v8_local_string_from) \
91+
v8::String::Utf8Value _v8_utf8_str_##cstr((isolate), (v8_local_string_from)); \
92+
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(_v8_utf8_str_##cstr, cstr); \
9393

94-
#define PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING_NODECL(cstr, v8_local_string_from) { \
95-
v8::String::Utf8Value _v8_utf8_str_##cstr((v8_local_string_from)); \
96-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK_NODECL(_v8_utf8_str_##cstr, cstr); \
97-
}
98-
99-
#define PHP_V8_SET_ZVAL_STRING_FROM_V8_STRING(zval_to, v8_local_string_from) { \
100-
v8::String::Utf8Value _v8_utf8_str((v8_local_string_from)); \
101-
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK(_v8_utf8_str, _v8_utf8_cstr); \
102-
ZVAL_STRINGL((zval_to), _v8_utf8_cstr, _v8_utf8_str.length()); \
103-
}
94+
#define PHP_V8_CONVERT_FROM_V8_STRING_TO_STRING_NODECL(isolate, cstr, v8_local_string_from) \
95+
v8::String::Utf8Value _v8_utf8_str_##cstr((isolate), (v8_local_string_from)); \
96+
PHP_V8_CONVERT_UTF8VALUE_TO_STRING_WITH_CHECK_NODECL(_v8_utf8_str_##cstr, cstr); \
10497

10598
struct _php_v8_value_t {
10699
php_v8_isolate_t *php_v8_isolate;

stubs/src/StringValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class StringValue extends NameValue
2323
{
24-
const MAX_LENGTH = (1 << 28) - 16;
24+
const MAX_LENGTH = (1 << 30) - 25; // It's (1 << 28) - 16 on x32 platform, but we don't run on x32.
2525

2626
/**
2727
* @param Isolate $isolate

0 commit comments

Comments
 (0)