php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23272 print_r does not display keys of private and protected variables
Submitted: 2003-04-18 10:21 UTC Modified: 2003-06-08 13:56 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: tim at timcrider dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-04-18 (dev) OS: Red Hat Linux 8.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tim at timcrider dot com
New email:
PHP Version: OS:

 

 [2003-04-18 10:21 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-18 11:50 UTC] nicos@php.net
Verified.
 [2003-06-08 13:56 UTC] zeev@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 03:01:32 2024 UTC