#23671 [NEW]: Function calls expose private functions in print_r output
| From: | agoossens at olc dot sa dot edu dot au | Date: | Sat, 17 May 2003 13:59:29 +0000 |
| Subject: | #23671 [NEW]: Function calls expose private functions in print_r output | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-39838@lists.php.net to get a copy of this message | ||
From: agoossens at olc dot sa dot edu dot au
Operating system: Windows XP, SP1
PHP version: 5CVS-2003-05-17 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: Function calls expose private functions in print_r output
Greetings all,
When a private function is called from within a class, it is exposed in
the print_r() (or var_dump()) output on it's object.
In order to explain this, consider this code:
class foo
{
private function sayFoo()
{
/* uncomment this line */
//$this->doSomeFoo();
}
private function doSomeFoo()
{
echo "Doing some foo\n";
}
}
$foo = new foo;
// print the structure of $foo
print_r($foo);
// var_dump($foo);
Initially, this will return
foo Object
(
)
Which is correct.
However, if you then uncomment the line in "sayFoo", the print_r will
return the name of the private function as one of the array indexes.
Changing the scope of "sayFoo" does the same thing no matter what scope
you use.
I'm pretty sure this isn't expected behaviour, as that would expose the
private function's existance (even though they still can't be accessed).
Tested on:
PHP 5.0.0-dev, 200305061830 build, Win32 package.
Cheers
-Adam Goossens
--
Edit bug report at http://bugs.php.net/?id=23671&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23671&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23671&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23671&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23671&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23671&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23671&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23671&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23671&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23671&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23671&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23671&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23671&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23671&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23671&r=gnused