Skip to content

Commit 13d3564

Browse files
committed
Fix #12063 convert PHP single-quote to C double-quote string
1 parent ba9650d commit 13d3564

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

build/gen_stub.php

+4
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,10 @@ public function getCExpr(): ?string
17681768
// $this->expr has all its PHP constants replaced by C constants
17691769
$prettyPrinter = new Standard;
17701770
$expr = $prettyPrinter->prettyPrintExpr($this->expr);
1771+
// PHP single-quote to C double-quote string
1772+
if ($this->type->isString()) {
1773+
$expr = preg_replace("/(^'|'$)/", '"', $expr);
1774+
}
17711775
return $expr[0] == '"' ? $expr : preg_replace('(\bnull\b)', 'NULL', str_replace('\\', '', $expr));
17721776
}
17731777
}

ext/zend_test/test.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ enum ZendTestUnitEnum {
143143

144144
enum ZendTestStringEnum: string {
145145
case Foo = "Test1";
146-
case Bar = "Test2";
146+
case Bar = 'Test2';
147147
case Baz = "Test2\\a";
148148
case FortyTwo = "42";
149149
}

ext/zend_test/test_arginfo.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)