#23272 [Opn->Ver]: print_r does not display keys of private and protected variables

From: Date: Fri, 18 Apr 2003 16:50:51 +0000
Subject: #23272 [Opn->Ver]: print_r does not display keys of private and protected variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37859@lists.php.net to get a copy of this message
ID: 23272 Updated by: nicos@php.net Reported By: tim at timcrider dot com -Status: Open +Status: Verified Bug Type: Class/Object related Operating System: Red Hat Linux 8.0 PHP Version: 5CVS-2003-04-18 (dev) New Comment: Verified. Previous Comments: ------------------------------------------------------------------------ [2003-04-18 10:21:59] tim at timcrider dot com When doing print_r on an object the array keys for the private and protected variables do not show, but their values do. -----[ class.php ]----- <?php class foo { private $bar; public $bar2; protected $bar3; function __construct() { $this->bar = 1; $this->bar2 = 2; $this->bar3 = 3; } } ?> -----[ run.php ]----- #!/php5/bin/php -q <?php require_once "class.php"; $a = New foo; print_r($a); ?> -----[ output ]----- foo Object ( [] => 1 [b] => 2 [] => 3 ) -----[ config ]----- ./configure --prefix=/php5 \ --with-gettext \ --with-gd=/usr \ --with-jpeg-dir=/usr/local \ --with-mcrypt=/usr/local \ --with-mcal=/usr/local \ --with-ming=/usr/local \ --with-mhash=/usr/local \ --with-mysql=/usr/local/mysql \ --with-zlib=/usr/local \ --with-ncurses \ --with-tiff-dir="/usr/local" \ --with-unixODBC=/usr/local/unixODBC \ --with-xml \ --with-calendar=shared \ --with-png-dir=/usr/local \ --with-freetype=/usr/local \ --with-freetype-dir=/usr/local \ --with-ttf=/usr/local \ --with-openssl=/usr/local \ --with-bz2 \ --with-dom \ --enable-bcmath \ --enable-calendar \ --enable-dio \ --enable-exif \ --enable-ftp \ --enable-gd-native-ttf \ --enable-pcntl \ --enable-shmop \ --enable-sigchild \ --enable-sockets \ --enable-track-vars \ --enable-magic-quotes \ --enable-trans-sid \ --enable-libgcc \ --enable-wddx \ --enable-sysvshm \ --enable-sysvsem \ --enable-sysvmsg ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23272&edit=1

« previous php.bugs (#37859) next »