diff --git a/src/gen_stub.php b/src/gen_stub.php index 5b19f312..125785cd 100755 --- a/src/gen_stub.php +++ b/src/gen_stub.php @@ -3125,9 +3125,6 @@ class StringBuilder { "false" => "ZEND_STR_FALSE", "null" => "ZEND_STR_NULL_LOWERCASE", "mixed" => "ZEND_STR_MIXED", - "any" => "ZEND_STR_MIXED", - "box" => "ZEND_STR_MIXED", - "stream" => "ZEND_STR_MIXED", ]; // NEW in 8.1 diff --git a/tests/compiler/attribute/pseudo-type-string-metadata.phpt b/tests/compiler/attribute/pseudo-type-string-metadata.phpt new file mode 100644 index 00000000..235c9b73 --- /dev/null +++ b/tests/compiler/attribute/pseudo-type-string-metadata.phpt @@ -0,0 +1,42 @@ +--TEST-- +attribute strings must not be rewritten through pseudo-type aliases +--FILE-- +getAttributes()[0]; + var_dump($attribute->getArguments()); + + $metadata = $attribute->newInstance(); + var_dump($metadata->stream, $metadata->any, $metadata->box); +} +?> +--EXPECT-- +array(3) { + ["stream"]=> + string(6) "stream" + ["any"]=> + string(3) "any" + ["box"]=> + string(3) "box" +} +string(6) "stream" +string(3) "any" +string(3) "box" diff --git a/tests/compiler/object_property/property-known-string-names.phpt b/tests/compiler/object_property/property-known-string-names.phpt new file mode 100644 index 00000000..339ddb4f --- /dev/null +++ b/tests/compiler/object_property/property-known-string-names.phpt @@ -0,0 +1,101 @@ +--TEST-- +property names must not be rewritten through pseudo-type string aliases +--FILE-- +stream = 'updated-stream'; + $this->any = 'updated-any'; + $this->box = 'updated-box'; + } + + public function values(): array + { + return [ + $this->mixed, + $this->stream, + $this->any, + $this->box, + $this->int, + $this->string, + $this->handleStream, + ]; + } +} + +function main(): void +{ + $object = new KnownStringProperties(); + var_dump($object->values()); + $object->update(); + var_dump($object->values()); + + $reflection = new ReflectionClass(KnownStringProperties::class); + $names = array_map( + static fn (ReflectionProperty $property): string => $property->getName(), + $reflection->getProperties(), + ); + sort($names); + var_dump($names); +} +?> +--EXPECT-- +array(7) { + [0]=> + string(5) "mixed" + [1]=> + string(14) "initial-stream" + [2]=> + string(11) "initial-any" + [3]=> + string(11) "initial-box" + [4]=> + int(42) + [5]=> + string(6) "string" + [6]=> + string(10) "camel-case" +} +array(7) { + [0]=> + string(5) "mixed" + [1]=> + string(14) "updated-stream" + [2]=> + string(11) "updated-any" + [3]=> + string(11) "updated-box" + [4]=> + int(42) + [5]=> + string(6) "string" + [6]=> + string(10) "camel-case" +} +array(7) { + [0]=> + string(3) "any" + [1]=> + string(3) "box" + [2]=> + string(12) "handleStream" + [3]=> + string(3) "int" + [4]=> + string(5) "mixed" + [5]=> + string(6) "stream" + [6]=> + string(6) "string" +}