#43719 [Opn->Bgs]: Confusing behaviour of "use" with functions

From: Date: Tue, 01 Jan 2008 16:13:39 +0000
Subject: #43719 [Opn->Bgs]: Confusing behaviour of "use" with functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120978@lists.php.net to get a copy of this message
ID: 43719 Updated by: johannes@php.net Reported By: sebastian@php.net -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Irrelevant PHP Version: 5.3CVS-2007-12-31 (CVS) Assigned To: dmitry New Comment: use a; This would use the class "a" as "a". The Warning tells you that this statement has no effect. or the second case: It was a design decision that functions can't be "use"d, see a recent post from Stas on internals on that. Previous Comments: ------------------------------------------------------------------------ [2007-12-31 14:34:41] sebastian@php.net Description: ------------ sb@vmware ~ % cat a.php <?php namespace a; function b() {} sb@vmware ~ % cat b.php && php b.php <?php require 'a.php'; use a; b(); Warning: The use statement with non-compound name 'a' has no effect in /home/sb/b.php on line 4 Fatal error: Call to undefined function b() in /home/sb/b.php on line 5 sb@vmware ~ % cat b.php && php b.php <?php require 'a.php'; use a::b; b(); Fatal error: Call to undefined function b() in /home/sb/b.php on line 5 Expected result: ---------------- Not sure. Actual result: -------------- See above. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43719&edit=1

« previous php.bugs (#120978) next »