????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.28 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/tests/classes/ |
Upload File : |
--TEST--
Unsetting and recreating private properties.
--FILE--
<?php
class C {
private $p = 'test';
function unsetPrivate() {
unset($this->p);
}
function setPrivate() {
$this->p = 'changed';
}
}
class D extends C {
function setP() {
$this->p = 'changed in D';
}
}
echo "Unset and recreate a superclass's private property:\n";
$d = new D;
$d->unsetPrivate();
$d->setPrivate();
var_dump($d);
echo "\nUnset superclass's private property, and recreate it as public in subclass:\n";
$d = new D;
$d->unsetPrivate();
$d->setP();
var_dump($d);
echo "\nUnset superclass's private property, and recreate it as public at global scope:\n";
$d = new D;
$d->unsetPrivate();
$d->p = 'this will create a public property';
var_dump($d);
echo "\n\nUnset and recreate a private property:\n";
$c = new C;
$c->unsetPrivate();
$c->setPrivate();
var_dump($c);
echo "\nUnset a private property, and attempt to recreate at global scope (expecting failure):\n";
$c = new C;
$c->unsetPrivate();
$c->p = 'this will fail';
var_dump($c);
?>
==Done==
--EXPECTF--
Unset and recreate a superclass's private property:
object(D)#%d (1) {
[%u|b%"p":%u|b%"C":private]=>
%unicode|string%(7) "changed"
}
Unset superclass's private property, and recreate it as public in subclass:
object(D)#%d (1) {
[%u|b%"p"]=>
%unicode|string%(12) "changed in D"
}
Unset superclass's private property, and recreate it as public at global scope:
object(D)#%d (1) {
[%u|b%"p"]=>
%unicode|string%(34) "this will create a public property"
}
Unset and recreate a private property:
object(C)#%d (1) {
[%u|b%"p":%u|b%"C":private]=>
%unicode|string%(7) "changed"
}
Unset a private property, and attempt to recreate at global scope (expecting failure):
Fatal error: Cannot access private property C::$p in %s on line 46