Req #75253 [Opn->Nab]: unable to call func_get_args() in a file required from within a function

From: Date: Sun, 24 Sep 2017 17:12:35 +0000
Subject: Req #75253 [Opn->Nab]: unable to call func_get_args() in a file required from within a function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211345@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75253&edit=1 ID: 75253 Updated by: jhdxr@php.net Reported by: Wes dot nospam at example dot org Summary: unable to call func_get_args() in a file required from within a function -Status: Open +Status: Not a bug Type: Feature/Change Request Package: *General Issues PHP Version: Irrelevant 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 Even if you can retrieve those info from debug_backtrace(), it doesn't prove this kind call of func_get_args() should be allow. Consider if it's allowed and file1 is under namespace Foo, while file2 is non-namespaced. It will leads to an undefined behavior, see https://wiki.php.net/rfc/forbid_dynamic_scope_introspection for more info. Previous Comments: ------------------------------------------------------------------------ [2017-09-24 12:55:24] Wes dot nospam at example dot org Description: ------------ This is disallowed: "called from the global scope" but should be allowed. the data is kind-of available anyway in debug_backtrace(). Test script: --------------- file1.php: <?php function bar($a, $b, $c){ require("file2.php"); } bar(1,2,3); file2.php: <?php assert(func_get_args() === [1,2,3]); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75253&edit=1

« previous php.bugs (#211345) next »