File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1616
1717#include <php.h>
1818
19+ #include "phongo_compat.h"
20+
1921#ifdef ZEND_HASH_GET_APPLY_COUNT /* PHP 7.2 or earlier recursion protection */
2022zend_bool php_phongo_zend_hash_apply_protection_begin (HashTable * ht )
2123{
@@ -44,7 +46,7 @@ zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht)
4446 }
4547 return 1 ;
4648}
47- #else /* PHP 7.3 or later */
49+ #else /* PHP 7.3 or later */
4850zend_bool php_phongo_zend_hash_apply_protection_begin (zend_array * ht )
4951{
5052 if (GC_IS_RECURSIVE (ht )) {
@@ -66,4 +68,22 @@ zend_bool php_phongo_zend_hash_apply_protection_end(zend_array* ht)
6668 }
6769 return 1 ;
6870}
69- #endif
71+ #endif /* ZEND_HASH_GET_APPLY_COUNT */
72+
73+ #if PHP_VERSION_ID < 80200
74+ const char * zend_get_object_type_case (const zend_class_entry * ce , zend_bool upper_case )
75+ {
76+ if (ce -> ce_flags & ZEND_ACC_TRAIT ) {
77+ return upper_case ? "Trait" : "trait" ;
78+ }
79+ if (ce -> ce_flags & ZEND_ACC_INTERFACE ) {
80+ return upper_case ? "Interface" : "interface" ;
81+ }
82+ #if PHP_VERSION_ID >= 80100
83+ if (ce -> ce_flags & ZEND_ACC_ENUM ) {
84+ return upper_case ? "Enum" : "enum" ;
85+ }
86+ #endif /* PHP_VERSION_ID > 80100 */
87+ return upper_case ? "Class" : "class" ;
88+ }
89+ #endif /* PHP_VERSION_ID < 80200 */
Original file line number Diff line number Diff line change @@ -315,4 +315,11 @@ static inline zend_bool zend_ini_parse_bool(zend_string* str)
315315zend_bool php_phongo_zend_hash_apply_protection_begin (HashTable * ht );
316316zend_bool php_phongo_zend_hash_apply_protection_end (HashTable * ht );
317317
318+ /* zend_get_object_type_case functions were introduced in PHP 8.2 */
319+ #if PHP_VERSION_ID < 80200
320+ const char * zend_get_object_type_case (const zend_class_entry * ce , zend_bool upper_case );
321+ #define zend_get_object_type (ce ) zend_get_object_type_case((ce), false)
322+ #define zend_get_object_type_uc (ce ) zend_get_object_type_case((ce), true)
323+ #endif /* PHP_VERSION_ID < 80200 */
324+
318325#endif /* PHONGO_COMPAT_H */
You can’t perform that action at this time.
0 commit comments