Bug #63201 [Ver->Dup]: Function overloading with namespace

From: Date: Sat, 11 Mar 2017 18:06:12 +0000
Subject: Bug #63201 [Ver->Dup]: Function overloading with namespace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207789@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:         nikic@php.net
 Reported by:        brainreflex at gmail dot com
 Summary:            Function overloading with namespace
-Status:             Verified
+Status:             Duplicate
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   *
 PHP Version:        *
 Block user comment: N
 Private report:     N

 New Comment:

Marking as duplicate of bug #64346.


Previous Comments:
------------------------------------------------------------------------
[2014-07-15 11:47:38] yohgaki@php.net

http://3v4l.org/0VGGt

------------------------------------------------------------------------
[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


Thread (5 messages)

« previous php.bugs (#207789) next »