diff options
author | Tyson Andre <tysonandre775@hotmail.com> | 2021-02-03 09:57:27 -0500 |
---|---|---|
committer | Tyson Andre <tysonandre775@hotmail.com> | 2021-02-06 14:09:25 -0500 |
commit | b4c6d5f7994746b9dcddc291c0bf7d91aa6e54cd (patch) | |
tree | ad84d3c6a4e90e53d98a54449bea8e8ef439835e /build | |
parent | 320843fe7b1e2f25fca0c634b49101e5baa4bb56 (diff) | |
download | php-git-b4c6d5f7994746b9dcddc291c0bf7d91aa6e54cd.tar.gz |
Properly render 2+ namespaces functions in build/gen_stub.php
Affects both INIT_NS_CLASS_ENTRY and ZEND_NS_FE
Add test cases of the global function and namespaced values
Closes GH-6664
Diffstat (limited to 'build')
-rwxr-xr-x | build/gen_stub.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/build/gen_stub.php b/build/gen_stub.php index 8653b6f3c5..38d58cf7c4 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -818,9 +818,10 @@ class FuncInfo { } if ($namespace) { + // Render A\B as "A\\B" in C strings for namespaces return sprintf( "\tZEND_NS_FE(\"%s\", %s, %s)\n", - $namespace, $declarationName, $this->getArgInfoName()); + addslashes($namespace), $declarationName, $this->getArgInfoName()); } else { return sprintf("\tZEND_FE(%s, %s)\n", $declarationName, $this->getArgInfoName()); } @@ -1222,7 +1223,7 @@ class ClassInfo { $code .= "\tzend_class_entry ce, *class_entry;\n\n"; if (count($this->name->parts) > 1) { $className = $this->name->getLast(); - $namespace = $this->name->slice(0, -1); + $namespace = addslashes((string) $this->name->slice(0, -1)); $code .= "\tINIT_NS_CLASS_ENTRY(ce, \"$namespace\", \"$className\", class_{$escapedName}_methods);\n"; } else { |