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 16
16
17
17
#include <php.h>
18
18
19
+ #include "phongo_compat.h"
20
+
19
21
#ifdef ZEND_HASH_GET_APPLY_COUNT /* PHP 7.2 or earlier recursion protection */
20
22
zend_bool php_phongo_zend_hash_apply_protection_begin (HashTable * ht )
21
23
{
@@ -44,7 +46,7 @@ zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht)
44
46
}
45
47
return 1 ;
46
48
}
47
- #else /* PHP 7.3 or later */
49
+ #else /* PHP 7.3 or later */
48
50
zend_bool php_phongo_zend_hash_apply_protection_begin (zend_array * ht )
49
51
{
50
52
if (GC_IS_RECURSIVE (ht )) {
@@ -66,4 +68,22 @@ zend_bool php_phongo_zend_hash_apply_protection_end(zend_array* ht)
66
68
}
67
69
return 1 ;
68
70
}
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)
315
315
zend_bool php_phongo_zend_hash_apply_protection_begin (HashTable * ht );
316
316
zend_bool php_phongo_zend_hash_apply_protection_end (HashTable * ht );
317
317
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
+
318
325
#endif /* PHONGO_COMPAT_H */
You can’t perform that action at this time.
0 commit comments