Skip to content

Commit af28c15

Browse files
committed
gen_stub: fix invalid C variable name for namespaced types in union/intersection type list
When generating a union or intersection type list with multiple class types, the variable holding each zend_string* was declared using toVarEscapedName() (backslashes replaced by underscores), but the subsequent ZEND_TYPE_INIT_CLASS() reference used toEscapedName() (backslashes escaped as \\), producing an invalid C identifier.
1 parent e60f880 commit af28c15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

build/gen_stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,8 +2375,8 @@ protected function getTypeCode(string $variableLikeName, string &$code): string
23752375
$code .= "\t{$variableLikeType}_{$variableLikeName}_type_list->num_types = $classTypeCount;\n";
23762376

23772377
foreach ($arginfoType->classTypes as $k => $classType) {
2378-
$escapedClassName = $classType->toEscapedName();
2379-
$code .= "\t{$variableLikeType}_{$variableLikeName}_type_list->types[$k] = (zend_type) ZEND_TYPE_INIT_CLASS({$variableLikeType}_{$variableLikeName}_class_{$escapedClassName}, 0, 0);\n";
2378+
$varEscapedClassName = $classType->toVarEscapedName();
2379+
$code .= "\t{$variableLikeType}_{$variableLikeName}_type_list->types[$k] = (zend_type) ZEND_TYPE_INIT_CLASS({$variableLikeType}_{$variableLikeName}_class_{$varEscapedClassName}, 0, 0);\n";
23802380
}
23812381

23822382
$typeMaskCode = $this->type->toArginfoType()->toTypeMask();

0 commit comments

Comments
 (0)