Bug #63201 [Opn->Ver]: Function overloading with namespace
| From: | yohgaki@php.net | Date: | Tue, 15 Jul 2014 11:47:38 +0000 |
| Subject: | Bug #63201 [Opn->Ver]: Function overloading with namespace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186626@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63201&edit=1
ID: 63201
Updated by: yohgaki@php.net
Reported by: brainreflex at gmail dot com
-Summary: PHP 5.4 and Function Overloading
+Summary: Function overloading with namespace
-Status: Open
+Status: Verified
Type: Bug
Package: Unknown/Other Function
-Operating System: OS X 10.7.5
+Operating System: *
-PHP Version: 5.4.7
+PHP Version: *
Block user comment: N
Private report: N
New Comment:
http://3v4l.org/0VGGt
Previous Comments:
------------------------------------------------------------------------
[2013-04-21 21:14:38] sjaillet at gmail dot com
It's pretty annoying since this feature allowed a king of monkey patching in PHP 5.3 for
writing tests cases.
With PHP 5.4 & 5.5, redefining functions only work in the same file like in the follwing
example:
<?php
namespace custom;
var_export('hello'); //hello
eval("namespace custom; function var_export(){echo 'foobar';}");
var_export('hello'); //foobar
?>
------------------------------------------------------------------------
[2013-04-20 00:50:18] sjaillet at gmail dot com
Looks like it's an introduced bug since redefining functions still works well when functions
had been called in the same file like the following :
<?php
namespace custom;
var_export('hello'); //hello
eval("namespace custom; function var_export(){echo 'foobar';}");
var_export('hello'); //foobar
?>
------------------------------------------------------------------------
[2012-10-02 15:26:53] brainreflex at gmail dot com
Description:
------------
5.4 doesn't allow to redefine function if bult-in function had been called
before. It's a bug or omission of documentation
For more details look at http://vatson.com.ua/blog/2012/10/01/php-5-dot-4-and-
function-overloading/
Test script:
---------------
https://github.com/vatson/php-experiments
Expected result:
----------------
The same behavior for both versions
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63201&edit=1