mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
* Fix GH-19044: Protected properties are not scoped according to their prototype * Adjust after review * Simplify to using prototype even for asymmetric visibility
27 lines
374 B
PHP
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)
|