From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      5.3.0alpha1
PHP Bug Type:     Scripting Engine problem
Bug description:  Case sensitive callback behaviour

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 bug report at http://bugs.php.net/?id=45744&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45744&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45744&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45744&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45744&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45744&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45744&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45744&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45744&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45744&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45744&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45744&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45744&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45744&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45744&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45744&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45744&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45744&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45744&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45744&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45744&r=mysqlcfg

Reply via email to