0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-09-16 18:05:18 +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,49 +7,25 @@ v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
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;
}
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;
}
}

View File

@ -7,61 +7,31 @@ v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
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;
}
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;
}
}

View File

@ -6,55 +6,28 @@ Test V8::executeString() : Use ArrayAccess with JavaScript native push method
v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
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 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);
}
}

View File

@ -6,77 +6,39 @@ Test V8::executeString() : Export PHP methods on ArrayAccess objects
v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
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;
}
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;
}
}

View File

@ -6,73 +6,37 @@ Test V8::executeString() : Export PHP properties on ArrayAccess objects
v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
private $privFoo = 23;
protected $protFoo = 23;
public $pubFoo = 42;
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;
/* 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);
}
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);
}
}

View File

@ -6,63 +6,32 @@ Test V8::executeString() : Export __invoke method on ArrayAccess objects
v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
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";
}
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";
}
}

View File

@ -6,55 +6,28 @@ Test V8::executeString() : Enumerate ArrayAccess keys
v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three', null, 'five');
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);
}
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);
}
}

View File

@ -6,59 +6,30 @@ Test V8::executeString() : Delete (unset) ArrayAccess keys
v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', 'two', 'three');
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;
}
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;
}
}

View File

@ -6,53 +6,27 @@ Test V8::executeString() : in array (isset) behaviour of ArrayAccess
v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
class MyArray implements ArrayAccess, Countable {
private $data = Array('one', null, 'three');
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;
}
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;
}
}

View File

@ -6,53 +6,27 @@ Test V8::executeString() : Check array access setter behaviour
v8js.use_array_access = 1
--FILE--
<?php
if (PHP_VERSION_ID < 80000) {
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);
}
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);
}
}

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);
#if PHP_VERSION_ID >= 80000
#define ZEND_ACC_DTOR 0
#endif
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;
/* 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<v8::Value> 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<v8::Value> 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);
}
}

View File

@ -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<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
zval php_value;
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;
#endif
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);
@ -1031,11 +1023,7 @@ static v8::Local<v8::Object> 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<v8::Object> 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<v8::Value> 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;
}

View File

@ -88,31 +88,12 @@ int v8js_get_properties_hash(v8::Local<v8::Value> 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

View File

@ -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)
{