????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 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 : /proc/self/root/home/b8009/php-5.6.22/ext/reflection/tests/ |
Upload File : |
--TEST--
Test ReflectionProperty::getValue() errors.
--FILE--
<?php
class TestClass {
public $pub;
public $pub2 = 5;
static public $stat = "static property";
protected $prot = 4;
private $priv = "keepOut";
}
class AnotherClass {
}
$instance = new TestClass();
$instanceWithNoProperties = new AnotherClass();
$propInfo = new ReflectionProperty('TestClass', 'pub2');
echo "Too few args:\n";
var_dump($propInfo->getValue());
echo "\nToo many args:\n";
var_dump($propInfo->getValue($instance, true));
echo "\nWrong type of arg:\n";
var_dump($propInfo->getValue(true));
echo "\nInstance without property:\n";
$propInfo = new ReflectionProperty('TestClass', 'stat');
echo "\nStatic property / too many args:\n";
var_dump($propInfo->getValue($instance, true));
echo "\nStatic property / wrong type of arg:\n";
var_dump($propInfo->getValue(true));
echo "\nProtected property:\n";
try {
$propInfo = new ReflectionProperty('TestClass', 'prot');
var_dump($propInfo->getValue($instance));
}
catch(Exception $exc) {
echo $exc->getMessage();
}
echo "\n\nInstance without property:\n";
$propInfo = new ReflectionProperty('TestClass', 'pub2');
var_dump($propInfo->getValue($instanceWithNoProperties));
?>
--EXPECTF--
Too few args:
Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Too many args:
Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Wrong type of arg:
Warning: ReflectionProperty::getValue() expects parameter 1 to be object, boolean given in %s on line %d
NULL
Instance without property:
Static property / too many args:
string(15) "static property"
Static property / wrong type of arg:
string(15) "static property"
Protected property:
Cannot access non-public member TestClass::prot
Instance without property:
NULL