1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/gh19044.phpt
Bob Weinand b13347be38 Fix GH-19044: Protected properties are not scoped according to their prototype (#19046)
* Fix GH-19044: Protected properties are not scoped according to their prototype

* Adjust after review

* Simplify to using prototype even for asymmetric visibility
2025-07-22 17:46:14 +02:00

27 lines
374 B
PHP

--TEST--
GH-19044: Protected properties must be scoped according to their prototype
--FILE--
<?php
abstract class P {
protected $foo;
}
class C1 extends P {
protected $foo = 1;
}
class C2 extends P {
protected $foo = 2;
static function foo($c) { return $c->foo; }
}
var_dump(C2::foo(new C2));
var_dump(C2::foo(new C1));
?>
--EXPECT--
int(2)
int(1)