From 826aaa689cd420d1ea0961109607a8641de31031 Mon Sep 17 00:00:00 2001 From: Jan-E Date: Thu, 5 Jul 2018 11:30:20 +0200 Subject: [PATCH] Change to GC_IS_RECURSIVE for PHP 7.3 --- v8js_convert.cc | 4 ++++ v8js_exceptions.cc | 4 ++++ v8js_object_export.cc | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/v8js_convert.cc b/v8js_convert.cc index 056e31b..4091cf0 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -70,7 +70,11 @@ 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) > 1) { +#endif return V8JS_NULL; } diff --git a/v8js_exceptions.cc b/v8js_exceptions.cc index 42fe7b1..967cae8 100644 --- a/v8js_exceptions.cc +++ b/v8js_exceptions.cc @@ -88,7 +88,11 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8:: zend_class_entry *exception_ce = zend_exception_get_default(); if (instanceof_function(php_exception->ce, exception_ce)) { +#ifdef GC_ADDREF + GC_ADDREF(php_exception); +#else ++GC_REFCOUNT(php_exception); +#endif zend_exception_set_previous(Z_OBJ_P(return_value), php_exception); } } diff --git a/v8js_object_export.cc b/v8js_object_export.cc index 4d61e76..85bd701 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -137,7 +137,9 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v 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; @@ -1013,7 +1015,11 @@ 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; }