Skip to content

Commit 85097c1

Browse files
committed
Merge open PRs into php7
2 parents 2bf4766 + ee2cf34 commit 85097c1

23 files changed

+588
-341
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ config.status
2020
config.sub
2121
configure
2222
configure.in
23+
configure.ac
2324
*~
2425
install-sh
2526
libtool

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ services:
55
- docker
66

77
env:
8-
- V8VER=6.6
8+
- V8VER=7.1
99
PHPVER=7.0
10-
- V8VER=6.6
10+
- V8VER=7.1
1111
PHPVER=7.1
12-
- V8VER=6.6
12+
- V8VER=7.1
1313
PHPVER=7.2
1414

1515
script: make -f Makefile.travis test

Dockerfile.travis

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apt-get update -q
99
RUN apt-get install -y software-properties-common
1010

1111
RUN add-apt-repository ppa:ondrej/php
12-
RUN add-apt-repository ppa:pinepain/php -y
12+
RUN add-apt-repository ppa:stesie/libv8 -y
1313
RUN apt-get update -q
1414

1515
RUN apt-get install -y php$PHPVER-dev libv8-$V8VER-dev

Makefile.travis

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Configure and build scripts for travis CI system
2-
V8VER ?= 6.6
2+
V8VER ?= 7.1
33

44
IMAGENAME ?= v8js-test
55

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Minimum requirements
2626
V8 is written in C++ and is used in Google Chrome, the open source browser from Google.
2727
V8 implements ECMAScript as specified in ECMA-262, 5th edition.
2828

29-
This extension requires V8 4.6.76 or higher.
29+
This extension requires V8 6.9 (6.9.427.18 is known to work) or higher.
3030

3131
V8 releases are published rather quickly and the V8 team usually provides security support
3232
for the version line shipped with the Chrome browser (stable channel) and newer (only).
@@ -44,7 +44,9 @@ For some very first steps, instead of compiling manually you might want to try o
4444
image](https://registry.hub.docker.com/u/stesie/v8js/). It has v8, v8js and php-cli pre-installed
4545
so you can give it a try with PHP in "interactive mode". There is no Apache, etc. running however.
4646

47-
For Ubuntu @pinepain has PPAs for [various versions of V8](https://launchpad.net/~pinepain).
47+
For Ubuntu @stesie has a PPA, based on prior work by @pinepain.
48+
[See here](https://launchpad.net/~stesie/+archive/ubuntu/libv8/), packaging sources are available
49+
[from ppa-packaging repository](https://github.com/phpv8/ppa-packaging/tree/stesie/) (*stesie* branch).
4850
You might want to install these and compile V8Js based on them.
4951

5052
There also is a Heroku extension pack that has recent V8Js versions for PHP 7.x, see
@@ -81,7 +83,6 @@ class V8Js
8183

8284
/**
8385
* Initializes and starts V8 engine and returns new V8Js object with it's own V8 context.
84-
* Snapshots are supported by V8 4.3.7 and higher.
8586
* @param string $object_name
8687
* @param array $variables
8788
* @param array $extensions

Vagrantfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Vagrant.configure("2") do |config|
1919
#
2020
# mass-define "generic" Ubuntu boxes
2121
#
22-
%w{6.3 6.4 6.5}.each { |version|
22+
%w{7.1}.each { |version|
2323
config.vm.define "v8-#{version}" do |i|
2424
i.vm.synced_folder ".", "/data/v8js"
2525

@@ -31,7 +31,7 @@ Vagrant.configure("2") do |config|
3131
apt-get install -y software-properties-common gdb tmux git tig curl apache2-utils lcov
3232
3333
add-apt-repository ppa:ondrej/php
34-
add-apt-repository ppa:pinepain/libv8-#{version}
34+
add-apt-repository ppa:stesie/libv8
3535
apt-get update
3636
apt-get install -y php7.1-dev libv8-#{version}-dbg libv8-#{version}-dev
3737
SHELL

appveyor.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ environment:
22
matrix:
33
- ARTIFACT_NAME: v8js_vc15_php-7.3_%Platform%_ts.zip
44
OUTDIR: Release_TS
5-
V8_ASSETS: V8-5.8.283.31-%Platform%.zip
6-
PHP_VERSION: 7.3.0alpha3
5+
V8_ASSETS: V8-7.0.276.11-vc15-%Platform%.zip
6+
PHP_VERSION: 7.3.0RC1
77
- ARTIFACT_NAME: v8js_vc15_php-7.3_%Platform%_nts.zip
88
OUTDIR: Release
99
CONFIGURE_EXTRA: --disable-zts
10-
V8_ASSETS: V8-5.8.283.31-%Platform%.zip
11-
PHP_VERSION: 7.3.0alpha3
10+
V8_ASSETS: V8-7.0.276.11-vc15-%Platform%.zip
11+
PHP_VERSION: 7.3.0RC1
1212
- ARTIFACT_NAME: v8js_vc15_php-7.2_%Platform%_ts.zip
1313
OUTDIR: Release_TS
14-
V8_ASSETS: V8-5.8.283.31-%Platform%.zip
15-
PHP_VERSION: 7.2.7
14+
V8_ASSETS: V8-7.0.276.11-vc15-%Platform%.zip
15+
PHP_VERSION: 7.2.10
1616
- ARTIFACT_NAME: v8js_vc15_php-7.2_%Platform%_nts.zip
1717
OUTDIR: Release
1818
CONFIGURE_EXTRA: --disable-zts
19-
V8_ASSETS: V8-5.8.283.31-%Platform%.zip
20-
PHP_VERSION: 7.2.7
19+
V8_ASSETS: V8-7.0.276.11-vc15-%Platform%.zip
20+
PHP_VERSION: 7.2.10
2121

2222
PHP_SDK: c:\projects\php-sdk
2323

@@ -30,20 +30,21 @@ platform:
3030

3131
install:
3232
- cd %PHP_SDK%
33-
- curl -fSL -o php-sdk-2.1.7beta1.zip "https://github.com/Microsoft/php-sdk-binary-tools/archive/php-sdk-2.1.7beta1.zip"
34-
- 7z.exe x php-sdk-2.1.7beta1.zip
35-
- move /y php-sdk-binary-tools-php-sdk-2.1.7beta1\* .
36-
- for /R /D %%f in (php-sdk-binary-tools-php-sdk-2.1.7beta1\*) do move /y %%f .
33+
- curl -fSL -o php-sdk-2.1.9beta1.zip "https://github.com/Microsoft/php-sdk-binary-tools/archive/php-sdk-2.1.9beta1.zip"
34+
- 7z.exe x php-sdk-2.1.9beta1.zip
35+
- move /y php-sdk-binary-tools-php-sdk-2.1.9beta1\* .
36+
- for /R /D %%f in (php-sdk-binary-tools-php-sdk-2.1.9beta1\*) do move /y %%f .
3737
- call bin\phpsdk_setvars.bat
3838
- call bin\phpsdk_buildtree.bat v8js-ci
3939
- cd v8js-ci\vc15\%Platform%
4040
- md deps
4141
- cd deps
42-
- curl -fSL -o %V8_ASSETS% "https://s3.amazonaws.com/win-phpv8/%V8_ASSETS%"
42+
- curl -fSL -o %V8_ASSETS% "https://phpdev.toolsforresearch.com/%V8_ASSETS%"
4343
- 7z.exe x %V8_ASSETS%
44-
- curl -fSL -o libiconv.zip "https://windows.php.net/downloads/php-sdk/deps/vc14/%Platform%/libiconv-1.15-vc14-%Platform%.zip"
44+
- dir
45+
- curl -fSL -o libiconv.zip "https://windows.php.net/downloads/php-sdk/deps/vc15/%Platform%/libiconv-1.15-3-vc15-%Platform%.zip"
4546
- 7z.exe x libiconv.zip -y
46-
- curl -fSL -o libxml2.zip "https://windows.php.net/downloads/php-sdk/deps/vc14/%Platform%/libxml2-2.9.8-vc14-%Platform%.zip"
47+
- curl -fSL -o libxml2.zip "https://windows.php.net/downloads/php-sdk/deps/vc15/%Platform%/libxml2-2.9.8-vc15-%Platform%.zip"
4748
- 7z.exe x libxml2.zip -y
4849
- cd ..
4950
- curl -fSL -o "php-%PHP_VERSION%.tar.gz" "https://github.com/php/php-src/archive/php-%PHP_VERSION%.tar.gz"

config.m4

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if test "$PHP_V8JS" != "no"; then
4343
old_CPPFLAGS=$CPPFLAGS
4444
AC_LANG_PUSH([C++])
4545
CPPFLAGS="-std="$ac_cv_v8_cstd
46-
AC_TRY_RUN([int main() { return 0; }],[],[ac_cv_v8_cstd="c++0x"],[])
46+
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],[],[ac_cv_v8_cstd="c++0x"],[])
4747
AC_LANG_POP([C++])
4848
CPPFLAGS=$old_CPPFLAGS
4949
]);
@@ -53,27 +53,27 @@ if test "$PHP_V8JS" != "no"; then
5353
old_CXXFLAGS=$CXXFLAGS
5454
AC_LANG_PUSH([C++])
5555
CXXFLAGS="-std="$ac_cv_v8_cstd
56-
AC_TRY_RUN([int main() {
56+
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() {
5757
struct { unsigned int x; } foo = {-1};
5858
(void) foo;
5959
return 0;
60-
}], [ ac_cv_v8_narrowing="" ], [
60+
}]])],[ac_cv_v8_narrowing=""],[
6161
CXXFLAGS="-Wno-c++11-narrowing -std="$ac_cv_v8_cstd
62-
AC_TRY_RUN([int main() {
62+
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() {
6363
struct { unsigned int x; } foo = {-1};
6464
(void) foo;
6565
return 0;
66-
}], [ ac_cv_v8_narrowing="-Wno-c++11-narrowing" ], [
66+
}]])],[ac_cv_v8_narrowing="-Wno-c++11-narrowing"],[
6767
CXXFLAGS="-Wno-narrowing -std="$ac_cv_v8_cstd
68-
AC_TRY_RUN([int main() {
68+
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() {
6969
struct { unsigned int x; } foo = {-1};
7070
(void) foo;
7171
return 0;
72-
}], [ ac_cv_v8_narrowing="-Wno-narrowing" ], [
72+
}]])],[ac_cv_v8_narrowing="-Wno-narrowing"],[
7373
AC_MSG_ERROR([cannot compile with narrowing])
74-
], [])
75-
], [])
76-
], [])
74+
],[])
75+
],[])
76+
],[])
7777
AC_LANG_POP([C++])
7878
CXXFLAGS=$old_CXXFLAGS
7979
]);
@@ -83,8 +83,7 @@ if test "$PHP_V8JS" != "no"; then
8383
old_LDFLAGS=$LDFLAGS
8484
old_CPPFLAGS=$CPPFLAGS
8585

86-
AC_LANG_SAVE
87-
AC_LANG_CPLUSPLUS
86+
AC_LANG_PUSH([C++])
8887

8988
CPPFLAGS="$CPPFLAGS -I$V8_DIR/include -std=$ac_cv_v8_cstd"
9089
LDFLAGS="$LDFLAGS -L$V8_DIR/$PHP_LIBDIR"
@@ -117,7 +116,7 @@ if test "$PHP_V8JS" != "no"; then
117116
dnl
118117
LIBS="$LIBS $V8JS_SHARED_LIBADD"
119118
AC_CACHE_CHECK(for V8 version, ac_cv_v8_version, [
120-
AC_TRY_RUN([#include <v8.h>
119+
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <v8.h>
121120
#include <iostream>
122121
#include <fstream>
123122
using namespace std;
@@ -132,7 +131,7 @@ int main ()
132131
return 0;
133132
}
134133
return 1;
135-
}], [ac_cv_v8_version=`cat ./conftestval|awk '{print $1}'`], [ac_cv_v8_version=NONE], [ac_cv_v8_version=NONE])
134+
}]])],[ac_cv_v8_version=`cat ./conftestval|awk '{print $1}'`],[ac_cv_v8_version=NONE],[ac_cv_v8_version=NONE])
136135
])
137136

138137
if test "$ac_cv_v8_version" != "NONE"; then
@@ -197,7 +196,7 @@ int main ()
197196
[Define unless v8::ArrayBuffer::Allocator::NewDefaultAllocator is usable.])
198197
fi
199198

200-
AC_LANG_RESTORE
199+
AC_LANG_POP([C++])
201200
LIBS=$old_LIBS
202201
LDFLAGS="$old_LDFLAGS"
203202
CPPFLAGS=$old_CPPFLAGS

config.w32

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ if (PHP_V8JS != "no") {
1515
ADD_FLAG("CFLAGS_V8JS", "/D __STDC_LIMIT_MACROS");
1616

1717
// defaults
18-
var v8major = 5;
19-
var v8minor = 8;
20-
var v8build = 301;
21-
var v8patch = 0;
18+
var v8major = 7;
19+
var v8minor = 0;
20+
var v8build = 276;
21+
var v8patch = 11;
2222
var v8pinc = search_paths("v8-version.h", php_usual_include_suspects, null);
2323
if (typeof(v8pinc) == "string") {
2424
var v8versionh = file_get_contents(v8pinc + '\\v8-version.h');

php_v8js_macros.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ extern "C" {
6565
/* V8Js Version */
6666
#define PHP_V8JS_VERSION "2.1.0"
6767

68-
/* Helper macros */
69-
#define V8JS_GET_CLASS_NAME(var, obj) \
70-
v8::String::Utf8Value var(obj->GetConstructorName());
71-
7268
/* Options */
7369
#define V8JS_FLAG_NONE (1<<0)
7470
#define V8JS_FLAG_FORCE_ARRAY (1<<1)

tests/timezones.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
--TEST--
22
Test V8::executeString() : Check timezone handling
33
--SKIPIF--
4+
SKIP test currently broken, see #378
5+
46
<?php
57
if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
68
die('SKIP TZ not handled by v8 on Windows');

v8js_array_access.cc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,20 +210,22 @@ void v8js_array_access_enumerator(const v8::PropertyCallbackInfo<v8::Array>& inf
210210

211211
for(int j = 0; j < length; j ++) {
212212
if(v8js_array_access_isset_p(object, j)) {
213-
result->Set(i ++, V8JS_INT(j));
213+
result->Set(isolate->GetEnteredContext(), i ++, V8JS_INT(j));
214214
}
215215
}
216216

217-
result->Set(V8JS_STR("length"), V8JS_INT(i));
217+
result->Set(isolate->GetEnteredContext(), V8JS_SYM("length"), V8JS_INT(i));
218218
info.GetReturnValue().Set(result);
219219
}
220220
/* }}} */
221221

222222

223223

224-
void v8js_array_access_named_getter(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value> &info) /* {{{ */
224+
void v8js_array_access_named_getter(v8::Local<v8::Name> property_name, const v8::PropertyCallbackInfo<v8::Value> &info) /* {{{ */
225225
{
226-
v8::String::Utf8Value cstr(property);
226+
v8::Local<v8::String> property = v8::Local<v8::String>::Cast(property_name);
227+
v8::Isolate *isolate = info.GetIsolate();
228+
v8::String::Utf8Value cstr(isolate, property);
227229
const char *name = ToCString(cstr);
228230

229231
if(strcmp(name, "length") == 0) {
@@ -234,7 +236,6 @@ void v8js_array_access_named_getter(v8::Local<v8::String> property, const v8::Pr
234236
v8::Local<v8::Value> ret_value = v8js_named_property_callback(property, info, V8JS_PROP_GETTER);
235237

236238
if(ret_value.IsEmpty()) {
237-
v8::Isolate *isolate = info.GetIsolate();
238239
v8::Local<v8::Array> arr = v8::Array::New(isolate);
239240
v8::Local<v8::Value> prototype = arr->GetPrototype();
240241

@@ -243,7 +244,13 @@ void v8js_array_access_named_getter(v8::Local<v8::String> property, const v8::Pr
243244
info.GetReturnValue().Set(ret_value);
244245
}
245246

246-
ret_value = prototype->ToObject()->Get(property);
247+
v8::Local<v8::Object> prototype_object;
248+
if(!prototype->ToObject(isolate->GetEnteredContext()).ToLocal(&prototype_object)) {
249+
/* ehh? Array.prototype not an object? strange, stop. */
250+
info.GetReturnValue().Set(ret_value);
251+
}
252+
253+
prototype_object->Get(isolate->GetEnteredContext(), property).ToLocal(&ret_value);
247254
}
248255

249256
info.GetReturnValue().Set(ret_value);

v8js_array_access.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void v8js_array_access_query(uint32_t index,
2525
const v8::PropertyCallbackInfo<v8::Integer>& info);
2626

2727
/* Named Property Handlers */
28-
void v8js_array_access_named_getter(v8::Local<v8::String> property,
28+
void v8js_array_access_named_getter(v8::Local<v8::Name> property,
2929
const v8::PropertyCallbackInfo<v8::Value> &info);
3030

3131
#endif /* V8JS_ARRAY_ACCESS_H */

0 commit comments

Comments
 (0)