Skip to content

Commit 4012902

Browse files
author
Martijn Otto
committed
Updated PHP-JS to be compatible with latest v8
1 parent 81cf121 commit 4012902

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

.clang_complete

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-std=c++11
2+
-Wno-pragma-once-outside-header

Makefile

+16-1
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,23 @@ NAME = php-js
2828
# PHP installations use a conf.d directory that holds a set of config files,
2929
# one for each extension. Use this variable to specify this directory.
3030
#
31+
# In Ubuntu 14.04 Apache 2.4 is used, which uses the mods-available directory
32+
# instead of a conf.d directory. In 16.04 the directory changed yet again.
33+
# This has to be checked.
34+
#
35+
36+
UBUNTU_MAJOR := $(shell /usr/bin/lsb_release -r -s | cut -f1 -d.)
37+
OVER_SIXTEEN := $(shell echo "${UBUNTU_MAJOR} >= 16" | bc)
38+
OVER_FOURTEEN := $(shell echo "${UBUNTU_MAJOR} >= 14" | bc)
39+
40+
ifeq (${OVER_SIXTEEN}, 1)
41+
INI_DIR = /etc/php/7.0/mods-available/
42+
else ifeq (${OVER_FOURTEEN}, 1)
43+
INI_DIR = /etc/php5/mods-available/
44+
else
45+
INI_DIR = /etc/php5/conf.d/
46+
endif
3147

32-
INI_DIR = /etc/php5/mods-available/
3348

3449

3550
#

external.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class External
4747
*
4848
* @param data callback data
4949
*/
50-
static void destructor(const v8::WeakCallbackData<v8::Value, External> &data)
50+
static void destructor(const v8::WeakCallbackInfo<External> &data)
5151
{
5252
// stop tracking the external reference
5353
Context::current()->untrack(data.GetParameter());
@@ -92,7 +92,7 @@ class External
9292
{
9393
// create the persistent handle and make it weak
9494
_persistent.Reset(Isolate::get(), handle);
95-
_persistent.SetWeak<External>(this, &destructor);
95+
_persistent.SetWeak<External>(this, &destructor, v8::WeakCallbackType::kParameter);
9696
}
9797

9898
/**

handle.h

-11
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ class Handle
4040
* @var v8::Handle<v8::External>
4141
*/
4242
v8::Local<v8::External> _handle;
43-
44-
/**
45-
* The destructor callback to clean up the object
46-
*
47-
* @param data callback data
48-
*/
49-
static void destructor(const v8::WeakCallbackData<v8::Value, External> &data)
50-
{
51-
// delete the object
52-
delete data.GetParameter();
53-
}
5443
public:
5544
/**
5645
* Constructor

0 commit comments

Comments
 (0)