From:             
Operating system: Ubuntu 10.10
PHP version:      5.3SVN-2011-04-11 (SVN)
Package:          Arrays related
Bug Type:         Bug
Bug description:array_map fails with namespaces

Description:
------------
Using php 5.3.3-1 array_map needs to have the namespace included in the
callback despite being called from within the same namespace.



This came up with OAuth.php. Example:

Test script:
---------------
namespace mynamespace;



class OAuthUtil {/*{{{*/

  public static function urlencode_rfc3986($input) {/*{{{*/

        if (is_array($input)) {

                return array_map(array('OAuthUtil','urlencode_rfc3986'), 
$input);

        } else if (is_scalar($input)) {

                return str_replace('+', ' ',

                               str_replace('%7E', '~', rawurlencode($input)));

        } else {

                return '';

        }

  }/*}}}*/

}

Expected result:
----------------
It should work the same as if the namespace were specified in the callback,
but it doesn't:



namespace mynamespace;



class OAuthUtil {/*{{{*/

  public static function urlencode_rfc3986($input) {/*{{{*/

        if (is_array($input)) {

                return 
array_map(array('\mynamespace\OAuthUtil','urlencode_rfc3986'),
$input);

        } else if (is_scalar($input)) {

                return str_replace('+', ' ',

                               str_replace('%7E', '~', rawurlencode($input)));

        } else {

                return '';

        }

  }/*}}}*/

}

Actual result:
--------------
It does not find the function that it should.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54509&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54509&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54509&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54509&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54509&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54509&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54509&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54509&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54509&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54509&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54509&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54509&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54509&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54509&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54509&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54509&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54509&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54509&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54509&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54509&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54509&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54509&r=mysqlcfg

Reply via email to