Bug #75157 [Opn->Nab]: function_exists() doesn't recognize imported functions

From: Date: Mon, 04 Sep 2017 17:31:29 +0000
Subject: Bug #75157 [Opn->Nab]: function_exists() doesn't recognize imported functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210941@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75157&edit=1 ID: 75157 Updated by: nikic@php.net Reported by: cmb@php.net Summary: function_exists() doesn't recognize imported functions -Status: Open +Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: * PHP Version: 7.0.23 Block user comment: N Private report: N New Comment: Just like with classes, function names in strings must always be fully qualified. "use function" is not a global reexport of the symbol, it's a local alias of the name. Previous Comments: ------------------------------------------------------------------------ [2017-09-04 17:27:21] cmb@php.net Description: ------------ If a namespaced function is imported into the global scope it is apparently not recognized by function_exists(). Test script: --------------- <?php namespace Foo { function bar() { echo 'I am there!'; } } namespace { use function Foo\bar; var_dump(function_exists('bar')); bar(); } Expected result: ---------------- bool(true) I am there! Actual result: -------------- bool(false) I am there! ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75157&edit=1

« previous php.bugs (#210941) next »