#45744 [Opn->Csd]: Case sensitive callback behaviour
| From: | dmitry@php.net | Date: | Thu, 07 Aug 2008 12:04:29 +0000 |
| Subject: | #45744 [Opn->Csd]: Case sensitive callback behaviour | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-127725@lists.php.net to get a copy of this message | ||
ID: 45744
Updated by: dmitry@php.net
Reported By: lstrojny@php.net
-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] lstrojny@php.net
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