0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 15:11:53 +00:00

eliminate PHP_VERSION_ID checks for < 80000 etc

This commit is contained in:
Stefan Siegl 2022-05-30 14:11:28 +02:00
parent 1455451e6f
commit 10cd73a03d
15 changed files with 211 additions and 587 deletions

View File

@ -7,30 +7,7 @@ v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
public function offsetExists($offset) {
return $offset >= 0 && $offset <= 20;
}
public function offsetGet($offset) {
return 19 - $offset;
}
public function offsetSet($offset, $value) {
throw new Exception('Not implemented');
}
public function offsetUnset($offset) {
throw new Exception('Not implemented');
}
public function count() {
return 20;
}
}
} else {
class MyArray implements ArrayAccess, Countable {
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
return $offset >= 0 && $offset <= 20; return $offset >= 0 && $offset <= 20;
} }
@ -50,7 +27,6 @@ if (PHP_VERSION_ID < 80000) {
public function count(): int { public function count(): int {
return 20; return 20;
} }
}
} }
$myarr = new MyArray(); $myarr = new MyArray();

View File

@ -7,36 +7,7 @@ v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
throw new Exception('Not implemented');
}
public function count() {
return count($this->data);
}
public function push($value) {
$this->data[] = $value;
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three'); private $data = Array('one', 'two', 'three');
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
@ -62,7 +33,6 @@ if (PHP_VERSION_ID < 80000) {
public function push($value) { public function push($value) {
$this->data[] = $value; $this->data[] = $value;
} }
}
} }
$v8 = new V8Js(); $v8 = new V8Js();

View File

@ -6,33 +6,7 @@ Test V8::executeString() : Use ArrayAccess with JavaScript native push method
v8js.use_array_access = 1 v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
echo "set[$offset] = $value\n";
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
throw new Exception('Not implemented');
}
public function count() {
return count($this->data);
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three'); private $data = Array('one', 'two', 'three');
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
@ -55,7 +29,6 @@ if (PHP_VERSION_ID < 80000) {
public function count(): int { public function count(): int {
return count($this->data); return count($this->data);
} }
}
} }
$v8 = new V8Js(); $v8 = new V8Js();

View File

@ -6,44 +6,7 @@ Test V8::executeString() : Export PHP methods on ArrayAccess objects
v8js.use_array_access = 1 v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
echo "set[$offset] = $value\n";
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
throw new Exception('Not implemented');
}
public function count() {
echo 'count() = ', count($this->data), "\n";
return count($this->data);
}
public function phpSidePush($value) {
echo "push << $value\n";
$this->data[] = $value;
}
public function push($value) {
echo "php-side-push << $value\n";
$this->data[] = $value;
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three'); private $data = Array('one', 'two', 'three');
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
@ -77,7 +40,6 @@ if (PHP_VERSION_ID < 80000) {
echo "php-side-push << $value\n"; echo "php-side-push << $value\n";
$this->data[] = $value; $this->data[] = $value;
} }
}
} }
$v8 = new V8Js(); $v8 = new V8Js();

View File

@ -6,42 +6,7 @@ Test V8::executeString() : Export PHP properties on ArrayAccess objects
v8js.use_array_access = 1 v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
private $privFoo = 23;
protected $protFoo = 23;
public $pubFoo = 42;
/* We can have a length property on the PHP object, but the length property
* of the JS object will still call count() method. Anyways it should be
* accessibly as $length. */
public $length = 42;
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
echo "set[$offset] = $value\n";
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
throw new Exception('Not implemented');
}
public function count() {
return count($this->data);
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three'); private $data = Array('one', 'two', 'three');
private $privFoo = 23; private $privFoo = 23;
@ -73,7 +38,6 @@ if (PHP_VERSION_ID < 80000) {
public function count(): int { public function count(): int {
return count($this->data); return count($this->data);
} }
}
} }
$v8 = new V8Js(); $v8 = new V8Js();

View File

@ -6,37 +6,7 @@ Test V8::executeString() : Export __invoke method on ArrayAccess objects
v8js.use_array_access = 1 v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
echo "set[$offset] = $value\n";
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
throw new Exception('Not implemented');
}
public function count() {
return count($this->data);
}
public function __invoke() {
echo "__invoke called!\n";
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three'); private $data = Array('one', 'two', 'three');
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
@ -63,7 +33,6 @@ if (PHP_VERSION_ID < 80000) {
public function __invoke() { public function __invoke() {
echo "__invoke called!\n"; echo "__invoke called!\n";
} }
}
} }
$v8 = new V8Js(); $v8 = new V8Js();

View File

@ -6,33 +6,7 @@ Test V8::executeString() : Enumerate ArrayAccess keys
v8js.use_array_access = 1 v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three', null, 'five');
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
echo "set[$offset] = $value\n";
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
throw new Exception('Not implemented');
}
public function count() {
return count($this->data);
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three', null, 'five'); private $data = Array('one', 'two', 'three', null, 'five');
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
@ -55,7 +29,6 @@ if (PHP_VERSION_ID < 80000) {
public function count(): int { public function count(): int {
return count($this->data); return count($this->data);
} }
}
} }
$v8 = new V8Js(); $v8 = new V8Js();

View File

@ -6,35 +6,7 @@ Test V8::executeString() : Delete (unset) ArrayAccess keys
v8js.use_array_access = 1 v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
if(!$this->offsetExists($offset)) {
return null;
}
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
unset($this->data[$offset]);
}
public function count() {
return max(array_keys($this->data)) + 1;
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three'); private $data = Array('one', 'two', 'three');
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
@ -59,7 +31,6 @@ if (PHP_VERSION_ID < 80000) {
public function count(): int { public function count(): int {
return max(array_keys($this->data)) + 1; return max(array_keys($this->data)) + 1;
} }
}
} }
$v8 = new V8Js(); $v8 = new V8Js();

View File

@ -6,32 +6,7 @@ Test V8::executeString() : in array (isset) behaviour of ArrayAccess
v8js.use_array_access = 1 v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', null, 'three');
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
unset($this->data[$offset]);
}
public function count() {
return max(array_keys($this->data)) + 1;
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', null, 'three'); private $data = Array('one', null, 'three');
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
@ -53,7 +28,6 @@ if (PHP_VERSION_ID < 80000) {
public function count(): int { public function count(): int {
return max(array_keys($this->data)) + 1; return max(array_keys($this->data)) + 1;
} }
}
} }
$v8 = new V8Js(); $v8 = new V8Js();

View File

@ -6,32 +6,7 @@ Test V8::executeString() : Check array access setter behaviour
v8js.use_array_access = 1 v8js.use_array_access = 1
--FILE-- --FILE--
<?php <?php
if (PHP_VERSION_ID < 80000) { class MyArray implements ArrayAccess, Countable {
class MyArray implements ArrayAccess, Countable {
private $data = array('one', 'two', 'three');
public function offsetExists($offset) {
return isset($this->data[$offset]);
}
public function offsetGet($offset) {
return $this->data[$offset];
}
public function offsetSet($offset, $value) {
$this->data[$offset] = $value;
}
public function offsetUnset($offset) {
throw new Exception('Not implemented');
}
public function count() {
return count($this->data);
}
}
} else {
class MyArray implements ArrayAccess, Countable {
private $data = array('one', 'two', 'three'); private $data = array('one', 'two', 'three');
public function offsetExists($offset): bool { public function offsetExists($offset): bool {
@ -53,7 +28,6 @@ if (PHP_VERSION_ID < 80000) {
public function count(): int { public function count(): int {
return count($this->data); return count($this->data);
} }
}
} }
$myarr = new MyArray(); $myarr = new MyArray();

View File

@ -87,9 +87,7 @@ static inline struct v8js_ctx *v8js_ctx_fetch_object(zend_object *obj) {
#define Z_V8JS_CTX_OBJ(zv) v8js_ctx_fetch_object(zv); #define Z_V8JS_CTX_OBJ(zv) v8js_ctx_fetch_object(zv);
#if PHP_VERSION_ID >= 80000
#define ZEND_ACC_DTOR 0 #define ZEND_ACC_DTOR 0
#endif
PHP_MINIT_FUNCTION(v8js_class); PHP_MINIT_FUNCTION(v8js_class);

View File

@ -70,12 +70,7 @@ static v8::Local<v8::Value> v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate
v8::Local<v8::Array> newarr; v8::Local<v8::Array> newarr;
/* Prevent recursion */ /* Prevent recursion */
#if PHP_VERSION_ID >= 70300 if (myht && GC_IS_RECURSIVE(myht)) {
if (myht && GC_IS_RECURSIVE(myht))
#else
if (myht && ZEND_HASH_GET_APPLY_COUNT(myht) > 0)
#endif
{
return V8JS_NULL; return V8JS_NULL;
} }
@ -87,12 +82,7 @@ static v8::Local<v8::Value> v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate
zval *data; zval *data;
zend_ulong index = 0; zend_ulong index = 0;
#if PHP_VERSION_ID >= 70300 if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE))
#else
if (myht)
#endif
{
GC_PROTECT_RECURSION(myht); GC_PROTECT_RECURSION(myht);
} }
@ -100,12 +90,7 @@ static v8::Local<v8::Value> v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate
newarr->Set(v8_context, index++, zval_to_v8js(data, isolate)); newarr->Set(v8_context, index++, zval_to_v8js(data, isolate));
} ZEND_HASH_FOREACH_END(); } ZEND_HASH_FOREACH_END();
#if PHP_VERSION_ID >= 70300 if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE))
#else
if (myht)
#endif
{
GC_UNPROTECT_RECURSION(myht); GC_UNPROTECT_RECURSION(myht);
} }
} }

View File

@ -150,9 +150,6 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, c
zend_try { zend_try {
/* zend_fcall_info_cache */ /* zend_fcall_info_cache */
#if PHP_VERSION_ID < 70300
fcc.initialized = 1;
#endif
fcc.function_handler = method_ptr; fcc.function_handler = method_ptr;
fcc.calling_scope = object->ce; fcc.calling_scope = object->ce;
fcc.called_scope = object->ce; fcc.called_scope = object->ce;
@ -643,12 +640,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
zval php_value; zval php_value;
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1)); zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
#if PHP_VERSION_ID < 80000
zval zobject;
ZVAL_OBJ(&zobject, object);
#else
zend_object &zobject = *object; zend_object &zobject = *object;
#endif
v8js_function_tmpl_t *tmpl_ptr = reinterpret_cast<v8js_function_tmpl_t *>(self->GetAlignedPointerFromInternalField(0)); v8js_function_tmpl_t *tmpl_ptr = reinterpret_cast<v8js_function_tmpl_t *>(self->GetAlignedPointerFromInternalField(0));
v8::Local<v8::FunctionTemplate> tmpl = v8::Local<v8::FunctionTemplate>::New(isolate, *tmpl_ptr); v8::Local<v8::FunctionTemplate> tmpl = v8::Local<v8::FunctionTemplate>::New(isolate, *tmpl_ptr);
@ -1031,11 +1023,7 @@ static v8::Local<v8::Object> v8js_wrap_array_to_object(v8::Isolate *isolate, zva
{ {
zval *data; zval *data;
#if PHP_VERSION_ID >= 70300
if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) { if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
#else
if (myht) {
#endif
GC_PROTECT_RECURSION(myht); GC_PROTECT_RECURSION(myht);
} }
@ -1067,11 +1055,7 @@ static v8::Local<v8::Object> v8js_wrap_array_to_object(v8::Isolate *isolate, zva
} ZEND_HASH_FOREACH_END(); } ZEND_HASH_FOREACH_END();
#if PHP_VERSION_ID >= 70300
if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) { if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
#else
if (myht) {
#endif
GC_UNPROTECT_RECURSION(myht); GC_UNPROTECT_RECURSION(myht);
} }
@ -1095,11 +1079,7 @@ v8::Local<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate) /* {{
} }
/* Prevent recursion */ /* Prevent recursion */
#if PHP_VERSION_ID >= 70300
if (myht && GC_IS_RECURSIVE(myht)) { if (myht && GC_IS_RECURSIVE(myht)) {
#else
if (myht && ZEND_HASH_GET_APPLY_COUNT(myht) > 1) {
#endif
return V8JS_NULL; return V8JS_NULL;
} }

View File

@ -88,31 +88,12 @@ int v8js_get_properties_hash(v8::Local<v8::Value> jsValue, HashTable *retval, in
V8JS_CTX_PROLOGUE(ctx); V8JS_CTX_PROLOGUE(ctx);
#if PHP_VERSION_ID < 70400
#define SINCE74(x,y) y
#else
#define SINCE74(x,y) x #define SINCE74(x,y) x
#endif
#if PHP_VERSION_ID < 80000
#define SINCE80(x,y) y
#else
#define SINCE80(x,y) x #define SINCE80(x,y) x
#endif
#if PHP_VERSION_ID < 70200
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \
ZEND_BEGIN_ARG_INFO_EX(name, return_reference, required_num_args, allow_null)
#endif
// polyfill for ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX, which changes between 7.1 and 7.2 // polyfill for ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX, which changes between 7.1 and 7.2
#if PHP_VERSION_ID < 70200
#define V8_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, /*class_name*/ 0, allow_null)
#else
#define V8_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ #define V8_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null)
#endif
// In PHP 8.1, mismatched tentative return types emit a deprecation notice. // In PHP 8.1, mismatched tentative return types emit a deprecation notice.
// https://wiki.php.net/rfc/internal_method_return_types // https://wiki.php.net/rfc/internal_method_return_types

View File

@ -252,14 +252,6 @@ static HashTable *v8js_v8object_get_properties(SINCE80(zend_object, zval) *objec
if (obj->properties == NULL) if (obj->properties == NULL)
{ {
#if PHP_VERSION_ID < 70300
if (GC_G(gc_active))
{
/* the garbage collector is running, don't create more zvals */
return NULL;
}
#endif
ALLOC_HASHTABLE(obj->properties); ALLOC_HASHTABLE(obj->properties);
zend_hash_init(obj->properties, 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_init(obj->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
@ -461,12 +453,6 @@ static zend_function *v8js_v8object_get_method(zend_object **object_ptr, zend_st
if (v8obj->ToObject(v8_context).ToLocal(&jsObj) && jsObj->Has(v8_context, jsKey).FromMaybe(false) && jsObj->Get(v8_context, jsKey).ToLocal(&jsObjSlot) && jsObjSlot->IsFunction()) if (v8obj->ToObject(v8_context).ToLocal(&jsObj) && jsObj->Has(v8_context, jsKey).FromMaybe(false) && jsObj->Get(v8_context, jsKey).ToLocal(&jsObjSlot) && jsObjSlot->IsFunction())
{ {
#if PHP_VERSION_ID < 80000
f = (zend_function *)ecalloc(1, sizeof(*f));
f->type = ZEND_OVERLOADED_FUNCTION_TEMPORARY;
f->common.function_name = zend_string_copy(method);
return f;
#else
f = (zend_internal_function *)ecalloc(1, sizeof(*f)); f = (zend_internal_function *)ecalloc(1, sizeof(*f));
f->type = ZEND_INTERNAL_FUNCTION; f->type = ZEND_INTERNAL_FUNCTION;
f->scope = (*object_ptr)->ce; f->scope = (*object_ptr)->ce;
@ -474,7 +460,6 @@ static zend_function *v8js_v8object_get_method(zend_object **object_ptr, zend_st
f->handler = ZEND_FN(zend_v8object_func); f->handler = ZEND_FN(zend_v8object_func);
f->function_name = zend_string_copy(method); f->function_name = zend_string_copy(method);
return (zend_function *)f; return (zend_function *)f;
#endif
} }
} }
@ -594,11 +579,7 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I
} }
/* }}} */ /* }}} */
#if PHP_VERSION_ID >= 80000
static int v8js_v8object_get_closure(zend_object *object, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **zobj_ptr, bool call) /* {{{ */ static int v8js_v8object_get_closure(zend_object *object, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **zobj_ptr, bool call) /* {{{ */
#else
static int v8js_v8object_get_closure(zval *object, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **zobj_ptr) /* {{{ */
#endif
{ {
SINCE80(zend_internal_function, zend_function) *invoke; SINCE80(zend_internal_function, zend_function) *invoke;
v8js_v8object *obj = SINCE80(Z_V8JS_V8OBJECT_OBJ, Z_V8JS_V8OBJECT_OBJ_P)(object); v8js_v8object *obj = SINCE80(Z_V8JS_V8OBJECT_OBJ, Z_V8JS_V8OBJECT_OBJ_P)(object);
@ -618,12 +599,6 @@ static int v8js_v8object_get_closure(zval *object, zend_class_entry **ce_ptr, ze
return FAILURE; return FAILURE;
} }
#if PHP_VERSION_ID < 80000
invoke = (zend_function *)ecalloc(1, sizeof(*invoke));
invoke->type = ZEND_OVERLOADED_FUNCTION_TEMPORARY;
invoke->common.function_name = zend_string_init(V8JS_V8_INVOKE_FUNC_NAME, sizeof(V8JS_V8_INVOKE_FUNC_NAME) - 1, 0);
*fptr_ptr = invoke;
#else
invoke = (zend_internal_function *)ecalloc(1, sizeof(*invoke)); invoke = (zend_internal_function *)ecalloc(1, sizeof(*invoke));
invoke->type = ZEND_INTERNAL_FUNCTION; invoke->type = ZEND_INTERNAL_FUNCTION;
invoke->fn_flags = ZEND_ACC_CALL_VIA_HANDLER; invoke->fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
@ -631,7 +606,6 @@ static int v8js_v8object_get_closure(zval *object, zend_class_entry **ce_ptr, ze
invoke->handler = ZEND_FN(zend_v8object_func); invoke->handler = ZEND_FN(zend_v8object_func);
invoke->function_name = zend_string_init(V8JS_V8_INVOKE_FUNC_NAME, sizeof(V8JS_V8_INVOKE_FUNC_NAME) - 1, 0); invoke->function_name = zend_string_init(V8JS_V8_INVOKE_FUNC_NAME, sizeof(V8JS_V8_INVOKE_FUNC_NAME) - 1, 0);
*fptr_ptr = (zend_function *)invoke; *fptr_ptr = (zend_function *)invoke;
#endif
if (zobj_ptr) if (zobj_ptr)
{ {