1--TEST-- 2Verify that parameter attributes for native functions do not leak. 3--EXTENSIONS-- 4zend_test 5--FILE-- 6<?php 7 8var_dump(zend_test_parameter_with_attribute("foo")); 9 10$o = new ZendTestClassWithMethodWithParameterAttribute(); 11var_dump($o->no_override("foo")); 12var_dump($o->override("foo")); 13 14$o = new ZendTestChildClassWithMethodWithParameterAttribute(); 15var_dump($o->no_override("foo")); 16var_dump($o->override("foo")); 17 18class ChildClassWithNoAttribute extends ZendTestClassWithMethodWithParameterAttribute { 19 public function override(string $parameter): int 20 { 21 return 5; 22 } 23} 24 25$o = new ChildClassWithNoAttribute(); 26var_dump($o->no_override("foo")); 27var_dump($o->override("foo")); 28 29class ChildClassWithSameAttribute extends ZendTestClassWithMethodWithParameterAttribute { 30 public function override(#[ZendTestParameterAttribute] string $parameter): int 31 { 32 return 6; 33 } 34} 35 36$o = new ChildClassWithSameAttribute(); 37var_dump($o->no_override("foo")); 38var_dump($o->override("foo")); 39 40#[\Attribute(\Attribute::TARGET_PARAMETER)] 41class SomeAttribute { 42 43} 44 45class ChildClassWithDifferentAttribute extends ZendTestClassWithMethodWithParameterAttribute { 46 public function override(#[SomeAttribute] string $parameter): int 47 { 48 return 7; 49 } 50} 51 52$o = new ChildClassWithDifferentAttribute(); 53var_dump($o->no_override("foo")); 54var_dump($o->override("foo")); 55 56?> 57--EXPECT-- 58int(1) 59int(2) 60int(3) 61int(2) 62int(4) 63int(2) 64int(5) 65int(2) 66int(6) 67int(2) 68int(7) 69