com php-src: Fix escapes for namespaced classes in gen_stub .php: scripts/dev/gen_stub.php
| From: | Christoph Michael Becker | Date: | Fri, 23 Aug 2019 10:29:55 +0000 |
| Subject: | com php-src: Fix escapes for namespaced classes in gen_stub .php: scripts/dev/gen_stub.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108003@lists.php.net to get a copy of this message | ||
Commit: 0c09089cafeb8a540986fa0a9dfe6c408508e946
Author: Tyson Andre <tysonandre775@hotmail.com> Thu, 22 Aug 2019 21:14:00 -0400
Committer: Christoph M. Becker <cmbecker69@gmx.de> Fri, 23 Aug 2019 12:29:55 +0200
Parents: 9b227640c162bf5de05d1105b58aa5c94e7e7272
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0c09089cafeb8a540986fa0a9dfe6c408508e946
Log:
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.
Changed paths:
M scripts/dev/gen_stub.php
Diff:
diff --git a/scripts/dev/gen_stub.php b/scripts/dev/gen_stub.php
index 6146009..0ae4a44 100755
--- a/scripts/dev/gen_stub.php
+++ b/scripts/dev/gen_stub.php
@@ -305,7 +305,7 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
$code .= sprintf(
"ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_%s, %d, %d, %s, %d)\n",
$funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs,
- $returnType->name, $returnType->isNullable
+ str_replace('\\', '\\\\', $returnType->name),
$returnType->isNullable
);
}
} else {
@@ -328,7 +328,7 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
$code .= sprintf(
"\tZEND_%s_OBJ_INFO(%d, %s, %s, %d)\n",
$argKind, $argInfo->byRef, $argInfo->name,
- $argInfo->type->name, $argInfo->type->isNullable
+ str_replace('\\', '\\\\', $argInfo->type->name),
$argInfo->type->isNullable
);
}
} else {