Skip to content

Commit 9bab49e

Browse files
fix startup error on php 8.3 when using named parameters
1 parent 5c9a31a commit 9bab49e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

zend/callable.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,14 @@ class Callable
232232
case Type::Array: info->type = (zend_type) ZEND_TYPE_INIT_CODE(IS_ARRAY, arg.allowNull(), _ZEND_ARG_INFO_FLAGS(arg.byReference(), 0, 0)); break; // array of anything (individual members cannot be restricted)
233233
case Type::Object:
234234
if (arg.classname()) {
235+
#if PHP_VERSION_ID < 83000
236+
// up to to 8.3 the type-names were normally given as "const char *"
235237
info->type = (zend_type) ZEND_TYPE_INIT_CLASS(arg.encoded(), arg.allowNull(), _ZEND_ARG_INFO_FLAGS(arg.byReference(), 0, 0));
238+
#else
239+
// since 8.3 a zend_string* is required, or a compile time "literal string" -- we fake the system by calling "ZEND_TYPE_INIT_CLASS_CONST"
240+
// to pretend that the name is not a zend_string* but a compile-time "const char *" (in reality it is a const char * stored in a std::string)
241+
info->type = (zend_type) ZEND_TYPE_INIT_CLASS_CONST(arg.encoded(), arg.allowNull(), _ZEND_ARG_INFO_FLAGS(arg.byReference(), 0, 0));
242+
#endif
236243
break;
237244
}
238245
info->type = (zend_type) ZEND_TYPE_INIT_CODE(IS_OBJECT, arg.allowNull(), _ZEND_ARG_INFO_FLAGS(arg.byReference(), 0, 0));

0 commit comments

Comments
 (0)