ID: 45744
Updated by: [email protected]
Reported By: [email protected]
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.0alpha1
New Comment:
This bug has been fixed in CVS.
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/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-08-07 10:01:17] [email protected]
Description:
------------
When running the small examples below, the first version works fine,
while the second triggers a warning:
Warning: array_map() expects parameter 1 to be a valid callback, cannot
access private method Bar::callBack() in /tmp/private_callback-buggy.php
on line 6
The only difference between the two code snippets is the callback being
camel case in the second example. Both versions work fine with 5.2.
Reproduce code:
---------------
First example:
<?php
class Foo
{
public function __construct(array $data)
{
var_dump(array_map(array($this, 'callback'), $data));
}
private function callback($value)
{
if (!is_array($value)) {
return stripslashes($value);
}
return array_map(array($this, 'callback'), $value);
}
}
class Bar extends Foo
{
}
var_dump(new Bar(array('foo' => 'bar', 'baz' => array('one',
'two\"'))));
Second example:
<?php
class Foo
{
public function __construct(array $data)
{
var_dump(array_map(array($this, 'callBack'), $data));
}
private function callBack($value)
{
if (!is_array($value)) {
return stripslashes($value);
}
return array_map(array($this, 'callBack'), $value);
}
}
class Bar extends Foo
{
}
var_dump(new Bar(array('foo' => 'bar', 'baz' => array('one',
'two\"'))));
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45744&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.