1--TEST--
2ReflectionClass::getStaticPropertyValue()
3--CREDITS--
4Robin Fernandes <robinf@php.net>
5Steve Seear <stevseea@php.net>
6--FILE--
7<?php
8class A {
9	static private $privateOverridden = "original private";
10	static protected $protectedOverridden = "original protected";
11	static public $publicOverridden = "original public";
12}
13
14class B extends A {
15	static private $privateOverridden = "changed private";
16	static protected $protectedOverridden = "changed protected";
17	static public $publicOverridden = "changed public";
18}
19
20echo "Retrieving static values from A:\n";
21$rcA = new ReflectionClass('A');
22var_dump($rcA->getStaticPropertyValue("privateOverridden", "default value"));
23var_dump($rcA->getStaticPropertyValue("\0A\0privateOverridden"));
24var_dump($rcA->getStaticPropertyValue("protectedOverridden", "default value"));
25var_dump($rcA->getStaticPropertyValue("\0*\0protectedOverridden"));
26var_dump($rcA->getStaticPropertyValue("publicOverridden"));
27
28echo "\nRetrieving static values from B:\n";
29$rcB = new ReflectionClass('B');
30var_dump($rcB->getStaticPropertyValue("\0A\0privateOverridden"));
31var_dump($rcB->getStaticPropertyValue("\0B\0privateOverridden"));
32var_dump($rcB->getStaticPropertyValue("\0*\0protectedOverridden"));
33var_dump($rcB->getStaticPropertyValue("publicOverridden"));
34
35echo "\nRetrieving non-existent values from A with no default value:\n";
36try {
37	var_dump($rcA->getStaticPropertyValue("protectedOverridden"));
38	echo "you should not see this";
39} catch (Exception $e) {
40	echo $e->getMessage() . "\n";
41}
42
43try {
44	var_dump($rcA->getStaticPropertyValue("privateOverridden"));
45	echo "you should not see this";
46} catch (Exception $e) {
47	echo $e->getMessage() . "\n";
48}
49
50?>
51--EXPECTF--
52Retrieving static values from A:
53string(13) "default value"
54string(16) "original private"
55string(13) "default value"
56string(18) "original protected"
57string(15) "original public"
58
59Retrieving static values from B:
60string(16) "original private"
61string(15) "changed private"
62string(17) "changed protected"
63string(14) "changed public"
64
65Retrieving non-existent values from A with no default value:
66Class A does not have a property named protectedOverridden
67Class A does not have a property named privateOverridden
68