diff --git a/phpunit/src/Generator/UtilsTest.php b/phpunit/src/Generator/UtilsTest.php index b94a0468..bcab4f74 100644 --- a/phpunit/src/Generator/UtilsTest.php +++ b/phpunit/src/Generator/UtilsTest.php @@ -186,6 +186,13 @@ class UtilsTest extends TestCase $this->assertStringStartsWith('_php__var__', $result); } + public function testEscapeVarNameStdioMacros(): void + { + foreach (['stdin', 'stdout', 'stderr'] as $name) { + $this->assertEquals('_php__var__' . $name, $this->invokeMethod('escapeVarName', $name)); + } + } + public function testUnescapeVarName(): void { $this->assertEquals('foo', $this->invokeMethod('unescapeVarName', '_php__var__foo')); diff --git a/src/Metadata/Constants.php b/src/Metadata/Constants.php index 019fc076..6c61b97f 100644 --- a/src/Metadata/Constants.php +++ b/src/Metadata/Constants.php @@ -109,6 +109,9 @@ class Constants 'while', 'xor', 'xor_eq', + 'stdin', // C stdio macros + 'stdout', + 'stderr', 'pipe', 'errno', // Linux error code 'this_', // phpx keywords