????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 216.73.216.170 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/b8009/php-5.6.22/ext/reflection/tests/ |
Upload File : |
--TEST-- ReflectionClass::setStaticPropertyValue() --CREDITS-- Robin Fernandes <robinf@php.net> Steve Seear <stevseea@php.net> --SKIPIF-- <?php if (version_compare(zend_version(), '2.4.0', '<')) die('skip ZendEngine 2.4 needed'); ?> --FILE-- <?php class A { static private $privateOverridden = "original private"; static protected $protectedOverridden = "original protected"; static public $publicOverridden = "original public"; } class B extends A { static private $privateOverridden = "changed private"; static protected $protectedOverridden = "changed protected"; static public $publicOverridden = "changed public"; } echo "Set static values in A:\n"; $rcA = new ReflectionClass('A'); $rcA->setStaticPropertyValue("\0A\0privateOverridden", "new value 1"); $rcA->setStaticPropertyValue("\0*\0protectedOverridden", "new value 2"); $rcA->setStaticPropertyValue("publicOverridden", "new value 3"); print_r($rcA->getStaticProperties()); echo "\nSet static values in B:\n"; $rcB = new ReflectionClass('B'); $rcB->setStaticPropertyValue("\0A\0privateOverridden", "new value 4"); $rcB->setStaticPropertyValue("\0B\0privateOverridden", "new value 5"); $rcB->setStaticPropertyValue("\0*\0protectedOverridden", "new value 6"); $rcB->setStaticPropertyValue("publicOverridden", "new value 7"); print_r($rcA->getStaticProperties()); print_r($rcB->getStaticProperties()); echo "\nSet non-existent values from A with no default value:\n"; try { var_dump($rcA->setStaticPropertyValue("protectedOverridden", "new value 8")); echo "you should not see this"; } catch (Exception $e) { echo $e->getMessage() . "\n"; } try { var_dump($rcA->setStaticPropertyValue("privateOverridden", "new value 9")); echo "you should not see this"; } catch (Exception $e) { echo $e->getMessage() . "\n"; } ?> --EXPECTF-- Set static values in A: Fatal error: Uncaught exception 'ReflectionException' with message 'Class A does not have a property named ' in %sReflectionClass_setStaticPropertyValue_001_2_4.php:%d Stack trace: #0 %sReflectionClass_setStaticPropertyValue_001_2_4.php(%d): ReflectionClass->setStaticPropertyValue('\x00A\x00privateOverr...', 'new value 1') #1 {main} thrown in %sReflectionClass_setStaticPropertyValue_001_2_4.php on line %d