Skip to content

Commit 0c09089

Browse files
TysonAndrecmb69
authored andcommitted
Fix escapes for namespaced classes in gen_stub.php
Fix the string generated when the `ns\class` is passed to a macro #define ESCAPE(x) #x // puts(ESCAPE(ns\class)); // warning: unknown escape sequence: \c puts(ESCAPE(ns\\class)); // Properly prints ns\class to stdout.
1 parent 9b22764 commit 0c09089

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/dev/gen_stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
305305
$code .= sprintf(
306306
"ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_%s, %d, %d, %s, %d)\n",
307307
$funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs,
308-
$returnType->name, $returnType->isNullable
308+
str_replace('\\', '\\\\', $returnType->name), $returnType->isNullable
309309
);
310310
}
311311
} else {
@@ -328,7 +328,7 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
328328
$code .= sprintf(
329329
"\tZEND_%s_OBJ_INFO(%d, %s, %s, %d)\n",
330330
$argKind, $argInfo->byRef, $argInfo->name,
331-
$argInfo->type->name, $argInfo->type->isNullable
331+
str_replace('\\', '\\\\', $argInfo->type->name), $argInfo->type->isNullable
332332
);
333333
}
334334
} else {

0 commit comments

Comments
 (0)