Edit report at http://bugs.php.net/bug.php?id=54509&edit=1

 ID:                 54509
 Updated by:         johan...@php.net
 Reported by:        alex at myrockgroup dot com
 Summary:            array_map fails with namespaces
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Arrays related
 Operating System:   Ubuntu 10.10
 PHP Version:        5.3SVN-2011-04-11 (SVN)
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

http://php.net/manual/en/language.namespaces.dynamic.php


Previous Comments:
------------------------------------------------------------------------
[2011-04-11 20:19:34] alex at myrockgroup dot com

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 this bug report at http://bugs.php.net/bug.php?id=54509&edit=1

Reply via email to