From 10cd73a03d6c87ddf5143654caf4c70e1a61be51 Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Mon, 30 May 2022 14:11:28 +0200 Subject: [PATCH] eliminate PHP_VERSION_ID checks for < 80000 etc --- tests/array_access.phpt | 60 +++++++-------------- tests/array_access_001.phpt | 66 +++++++---------------- tests/array_access_002.phpt | 67 +++++++----------------- tests/array_access_003.phpt | 96 ++++++++++------------------------ tests/array_access_004.phpt | 82 ++++++++--------------------- tests/array_access_005.phpt | 79 +++++++++------------------- tests/array_access_006.phpt | 67 +++++++----------------- tests/array_access_007.phpt | 71 ++++++++----------------- tests/array_access_008.phpt | 64 +++++++---------------- tests/array_access_basic2.phpt | 58 ++++++-------------- v8js_class.h | 2 - v8js_convert.cc | 21 ++------ v8js_object_export.cc | 20 ------- v8js_v8.h | 19 ------- v8js_v8object_class.cc | 26 --------- 15 files changed, 211 insertions(+), 587 deletions(-) diff --git a/tests/array_access.phpt b/tests/array_access.phpt index 3163734..80f8387 100644 --- a/tests/array_access.phpt +++ b/tests/array_access.phpt @@ -7,49 +7,25 @@ v8js.use_array_access = 1 --FILE-- = 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; - } +class MyArray implements ArrayAccess, Countable { + public function offsetExists($offset): bool { + return $offset >= 0 && $offset <= 20; } -} else { - class MyArray implements ArrayAccess, Countable { - public function offsetExists($offset): bool { - return $offset >= 0 && $offset <= 20; - } - - public function offsetGet(mixed $offset): mixed { - return 19 - $offset; - } - - public function offsetSet(mixed $offset, mixed $value): void { - throw new Exception('Not implemented'); - } - - public function offsetUnset(mixed $offset): void { - throw new Exception('Not implemented'); - } - - public function count(): int { - return 20; - } + + public function offsetGet(mixed $offset): mixed { + return 19 - $offset; + } + + public function offsetSet(mixed $offset, mixed $value): void { + throw new Exception('Not implemented'); + } + + public function offsetUnset(mixed $offset): void { + throw new Exception('Not implemented'); + } + + public function count(): int { + return 20; } } diff --git a/tests/array_access_001.phpt b/tests/array_access_001.phpt index 92aa264..83cbd8d 100644 --- a/tests/array_access_001.phpt +++ b/tests/array_access_001.phpt @@ -7,61 +7,31 @@ v8js.use_array_access = 1 --FILE-- 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; - } + public function offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = Array('one', 'two', 'three'); - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } + public function offsetGet(mixed $offset): mixed { + return $this->data[$offset]; + } - public function offsetGet(mixed $offset): mixed { - return $this->data[$offset]; - } + public function offsetSet(mixed $offset, mixed $value): void { + $this->data[$offset] = $value; + } - public function offsetSet(mixed $offset, mixed $value): void { - $this->data[$offset] = $value; - } + public function offsetUnset(mixed $offset): void { + throw new Exception('Not implemented'); + } - public function offsetUnset(mixed $offset): void { - throw new Exception('Not implemented'); - } + public function count(): int { + return count($this->data); + } - public function count(): int { - return count($this->data); - } - - public function push($value) { - $this->data[] = $value; - } + public function push($value) { + $this->data[] = $value; } } diff --git a/tests/array_access_002.phpt b/tests/array_access_002.phpt index f7db125..f8c6e88 100644 --- a/tests/array_access_002.phpt +++ b/tests/array_access_002.phpt @@ -6,55 +6,28 @@ Test V8::executeString() : Use ArrayAccess with JavaScript native push method v8js.use_array_access = 1 --FILE-- 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 offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = Array('one', 'two', 'three'); - - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } - - public function offsetGet(mixed $offset): mixed { - return $this->data[$offset]; - } - - public function offsetSet(mixed $offset, mixed $value): void { - echo "set[$offset] = $value\n"; - $this->data[$offset] = $value; - } - - public function offsetUnset(mixed $offset): void { - throw new Exception('Not implemented'); - } - - public function count(): int { - return count($this->data); - } + + public function offsetGet(mixed $offset): mixed { + return $this->data[$offset]; + } + + public function offsetSet(mixed $offset, mixed $value): void { + echo "set[$offset] = $value\n"; + $this->data[$offset] = $value; + } + + public function offsetUnset(mixed $offset): void { + throw new Exception('Not implemented'); + } + + public function count(): int { + return count($this->data); } } diff --git a/tests/array_access_003.phpt b/tests/array_access_003.phpt index f488272..5adc5fa 100644 --- a/tests/array_access_003.phpt +++ b/tests/array_access_003.phpt @@ -6,77 +6,39 @@ Test V8::executeString() : Export PHP methods on ArrayAccess objects v8js.use_array_access = 1 --FILE-- 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; - } + public function offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = Array('one', 'two', 'three'); - - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } - - public function offsetGet(mixed $offset): mixed { - return $this->data[$offset]; - } - - public function offsetSet(mixed $offset, mixed $value): void { - echo "set[$offset] = $value\n"; - $this->data[$offset] = $value; - } - - public function offsetUnset(mixed $offset): void { - throw new Exception('Not implemented'); - } - - public function count(): int { - echo 'count() = ', count($this->data), "\n"; - return count($this->data); - } - public function phpSidePush($value) { - echo "push << $value\n"; - $this->data[] = $value; - } + public function offsetGet(mixed $offset): mixed { + return $this->data[$offset]; + } - public function push($value) { - echo "php-side-push << $value\n"; - $this->data[] = $value; - } + public function offsetSet(mixed $offset, mixed $value): void { + echo "set[$offset] = $value\n"; + $this->data[$offset] = $value; + } + + public function offsetUnset(mixed $offset): void { + throw new Exception('Not implemented'); + } + + public function count(): int { + 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; } } diff --git a/tests/array_access_004.phpt b/tests/array_access_004.phpt index c5c664b..dce9ad5 100644 --- a/tests/array_access_004.phpt +++ b/tests/array_access_004.phpt @@ -6,73 +6,37 @@ Test V8::executeString() : Export PHP properties on ArrayAccess objects v8js.use_array_access = 1 --FILE-- 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 offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = Array('one', 'two', 'three'); - private $privFoo = 23; - protected $protFoo = 23; - public $pubFoo = 42; + public function offsetGet(mixed $offset): mixed { + return $this->data[$offset]; + } - /* 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 offsetSet(mixed $offset, mixed $value): void { + echo "set[$offset] = $value\n"; + $this->data[$offset] = $value; + } - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } + public function offsetUnset(mixed $offset): void { + throw new Exception('Not implemented'); + } - public function offsetGet(mixed $offset): mixed { - return $this->data[$offset]; - } - - public function offsetSet(mixed $offset, mixed $value): void { - echo "set[$offset] = $value\n"; - $this->data[$offset] = $value; - } - - public function offsetUnset(mixed $offset): void { - throw new Exception('Not implemented'); - } - - public function count(): int { - return count($this->data); - } + public function count(): int { + return count($this->data); } } diff --git a/tests/array_access_005.phpt b/tests/array_access_005.phpt index ba6bc73..603e770 100644 --- a/tests/array_access_005.phpt +++ b/tests/array_access_005.phpt @@ -6,63 +6,32 @@ Test V8::executeString() : Export __invoke method on ArrayAccess objects v8js.use_array_access = 1 --FILE-- 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"; - } + public function offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = Array('one', 'two', 'three'); - - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } - - public function offsetGet(mixed $offset): mixed { - return $this->data[$offset]; - } - - public function offsetSet(mixed $offset, mixed $value): void { - echo "set[$offset] = $value\n"; - $this->data[$offset] = $value; - } - - public function offsetUnset(mixed $offset): void { - throw new Exception('Not implemented'); - } - - public function count(): int { - return count($this->data); - } - - public function __invoke() { - echo "__invoke called!\n"; - } + + public function offsetGet(mixed $offset): mixed { + return $this->data[$offset]; + } + + public function offsetSet(mixed $offset, mixed $value): void { + echo "set[$offset] = $value\n"; + $this->data[$offset] = $value; + } + + public function offsetUnset(mixed $offset): void { + throw new Exception('Not implemented'); + } + + public function count(): int { + return count($this->data); + } + + public function __invoke() { + echo "__invoke called!\n"; } } diff --git a/tests/array_access_006.phpt b/tests/array_access_006.phpt index 96af8e3..05260b0 100644 --- a/tests/array_access_006.phpt +++ b/tests/array_access_006.phpt @@ -6,55 +6,28 @@ Test V8::executeString() : Enumerate ArrayAccess keys v8js.use_array_access = 1 --FILE-- 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 offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = Array('one', 'two', 'three', null, 'five'); - - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } - - public function offsetGet(mixed $offset): mixed { - return $this->data[$offset]; - } - - public function offsetSet(mixed $offset, mixed $value): void { - echo "set[$offset] = $value\n"; - $this->data[$offset] = $value; - } - - public function offsetUnset(mixed $offset): void { - throw new Exception('Not implemented'); - } - - public function count(): int { - return count($this->data); - } + + public function offsetGet(mixed $offset): mixed { + return $this->data[$offset]; + } + + public function offsetSet(mixed $offset, mixed $value): void { + echo "set[$offset] = $value\n"; + $this->data[$offset] = $value; + } + + public function offsetUnset(mixed $offset): void { + throw new Exception('Not implemented'); + } + + public function count(): int { + return count($this->data); } } diff --git a/tests/array_access_007.phpt b/tests/array_access_007.phpt index 1210c12..ce52866 100644 --- a/tests/array_access_007.phpt +++ b/tests/array_access_007.phpt @@ -6,59 +6,30 @@ Test V8::executeString() : Delete (unset) ArrayAccess keys v8js.use_array_access = 1 --FILE-- 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; - } + public function offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = Array('one', 'two', 'three'); - - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } - - public function offsetGet(mixed $offset): mixed { - if(!$this->offsetExists($offset)) { - return null; - } - return $this->data[$offset]; - } - - public function offsetSet(mixed $offset, mixed $value): void { - $this->data[$offset] = $value; - } - - public function offsetUnset(mixed $offset): void { - unset($this->data[$offset]); - } - - public function count(): int { - return max(array_keys($this->data)) + 1; + + public function offsetGet(mixed $offset): mixed { + if(!$this->offsetExists($offset)) { + return null; } + return $this->data[$offset]; + } + + public function offsetSet(mixed $offset, mixed $value): void { + $this->data[$offset] = $value; + } + + public function offsetUnset(mixed $offset): void { + unset($this->data[$offset]); + } + + public function count(): int { + return max(array_keys($this->data)) + 1; } } diff --git a/tests/array_access_008.phpt b/tests/array_access_008.phpt index f49942d..67fae5e 100644 --- a/tests/array_access_008.phpt +++ b/tests/array_access_008.phpt @@ -6,53 +6,27 @@ Test V8::executeString() : in array (isset) behaviour of ArrayAccess v8js.use_array_access = 1 --FILE-- 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; - } + public function offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = Array('one', null, 'three'); - - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } - - public function offsetGet(mixed $offset): mixed { - return $this->data[$offset]; - } - - public function offsetSet(mixed $offset, mixed $value): void { - $this->data[$offset] = $value; - } - - public function offsetUnset(mixed $offset): void { - unset($this->data[$offset]); - } - - public function count(): int { - return max(array_keys($this->data)) + 1; - } + + public function offsetGet(mixed $offset): mixed { + return $this->data[$offset]; + } + + public function offsetSet(mixed $offset, mixed $value): void { + $this->data[$offset] = $value; + } + + public function offsetUnset(mixed $offset): void { + unset($this->data[$offset]); + } + + public function count(): int { + return max(array_keys($this->data)) + 1; } } diff --git a/tests/array_access_basic2.phpt b/tests/array_access_basic2.phpt index 0cbf403..a658a39 100644 --- a/tests/array_access_basic2.phpt +++ b/tests/array_access_basic2.phpt @@ -6,53 +6,27 @@ Test V8::executeString() : Check array access setter behaviour v8js.use_array_access = 1 --FILE-- 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); - } +class MyArray implements ArrayAccess, Countable { + private $data = array('one', 'two', 'three'); + + public function offsetExists($offset): bool { + return isset($this->data[$offset]); } -} else { - class MyArray implements ArrayAccess, Countable { - private $data = array('one', 'two', 'three'); - public function offsetExists($offset): bool { - return isset($this->data[$offset]); - } + public function offsetGet(mixed $offset): mixed { + return $this->data[$offset]; + } - public function offsetGet(mixed $offset): mixed { - return $this->data[$offset]; - } + public function offsetSet(mixed $offset, mixed $value): void { + $this->data[$offset] = $value; + } - public function offsetSet(mixed $offset, mixed $value): void { - $this->data[$offset] = $value; - } + public function offsetUnset(mixed $offset): void { + throw new Exception('Not implemented'); + } - public function offsetUnset(mixed $offset): void { - throw new Exception('Not implemented'); - } - - public function count(): int { - return count($this->data); - } + public function count(): int { + return count($this->data); } } diff --git a/v8js_class.h b/v8js_class.h index cabdee8..38efc83 100644 --- a/v8js_class.h +++ b/v8js_class.h @@ -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); -#if PHP_VERSION_ID >= 80000 #define ZEND_ACC_DTOR 0 -#endif PHP_MINIT_FUNCTION(v8js_class); diff --git a/v8js_convert.cc b/v8js_convert.cc index a8ef6dc..67aa4ce 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -70,12 +70,7 @@ static v8::Local v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate v8::Local newarr; /* Prevent recursion */ -#if PHP_VERSION_ID >= 70300 - if (myht && GC_IS_RECURSIVE(myht)) -#else - if (myht && ZEND_HASH_GET_APPLY_COUNT(myht) > 0) -#endif - { + if (myht && GC_IS_RECURSIVE(myht)) { return V8JS_NULL; } @@ -87,12 +82,7 @@ static v8::Local v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate zval *data; zend_ulong index = 0; -#if PHP_VERSION_ID >= 70300 - if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) -#else - if (myht) -#endif - { + if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) { GC_PROTECT_RECURSION(myht); } @@ -100,12 +90,7 @@ static v8::Local v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate newarr->Set(v8_context, index++, zval_to_v8js(data, isolate)); } ZEND_HASH_FOREACH_END(); -#if PHP_VERSION_ID >= 70300 - if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) -#else - if (myht) -#endif - { + if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) { GC_UNPROTECT_RECURSION(myht); } } diff --git a/v8js_object_export.cc b/v8js_object_export.cc index 6b3b59b..72fcb58 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -150,9 +150,6 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, c zend_try { /* zend_fcall_info_cache */ -#if PHP_VERSION_ID < 70300 - fcc.initialized = 1; -#endif fcc.function_handler = method_ptr; fcc.calling_scope = object->ce; fcc.called_scope = object->ce; @@ -643,12 +640,7 @@ v8::Local v8js_named_property_callback(v8::Local property_n zval php_value; zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); - #if PHP_VERSION_ID < 80000 - zval zobject; - ZVAL_OBJ(&zobject, object); - #else zend_object &zobject = *object; - #endif v8js_function_tmpl_t *tmpl_ptr = reinterpret_cast(self->GetAlignedPointerFromInternalField(0)); v8::Local tmpl = v8::Local::New(isolate, *tmpl_ptr); @@ -1031,11 +1023,7 @@ static v8::Local v8js_wrap_array_to_object(v8::Isolate *isolate, zva { zval *data; -#if PHP_VERSION_ID >= 70300 if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) { -#else - if (myht) { -#endif GC_PROTECT_RECURSION(myht); } @@ -1067,11 +1055,7 @@ static v8::Local v8js_wrap_array_to_object(v8::Isolate *isolate, zva } ZEND_HASH_FOREACH_END(); -#if PHP_VERSION_ID >= 70300 if (myht && !(GC_FLAGS(myht) & GC_IMMUTABLE)) { -#else - if (myht) { -#endif GC_UNPROTECT_RECURSION(myht); } @@ -1095,11 +1079,7 @@ v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate) /* {{ } /* Prevent recursion */ -#if PHP_VERSION_ID >= 70300 if (myht && GC_IS_RECURSIVE(myht)) { -#else - if (myht && ZEND_HASH_GET_APPLY_COUNT(myht) > 1) { -#endif return V8JS_NULL; } diff --git a/v8js_v8.h b/v8js_v8.h index 59b374d..421cfde 100644 --- a/v8js_v8.h +++ b/v8js_v8.h @@ -88,31 +88,12 @@ int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, in V8JS_CTX_PROLOGUE(ctx); -#if PHP_VERSION_ID < 70400 -#define SINCE74(x,y) y -#else #define SINCE74(x,y) x -#endif - -#if PHP_VERSION_ID < 80000 -#define SINCE80(x,y) y -#else #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 -#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) \ 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. // https://wiki.php.net/rfc/internal_method_return_types diff --git a/v8js_v8object_class.cc b/v8js_v8object_class.cc index b13554b..c59e633 100644 --- a/v8js_v8object_class.cc +++ b/v8js_v8object_class.cc @@ -252,14 +252,6 @@ static HashTable *v8js_v8object_get_properties(SINCE80(zend_object, zval) *objec 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); 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 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->type = ZEND_INTERNAL_FUNCTION; 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->function_name = zend_string_copy(method); 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) /* {{{ */ -#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; 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; } -#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->type = ZEND_INTERNAL_FUNCTION; 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->function_name = zend_string_init(V8JS_V8_INVOKE_FUNC_NAME, sizeof(V8JS_V8_INVOKE_FUNC_NAME) - 1, 0); *fptr_ptr = (zend_function *)invoke; -#endif if (zobj_ptr) {