#45283 [Opn]: extract($_FILES) result unpredictable

From: Date: Sat, 08 Nov 2008 01:37:37 +0000
Subject: #45283 [Opn]: extract($_FILES) result unpredictable
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1465@lists.php.net to get a copy of this message
ID: 45283 Updated by: jani@php.net Reported By: php at info-svc dot com Status: Open -Bug Type: Scripting Engine problem +Bug Type: Documentation problem Operating System: * PHP Version: 5.2.6 New Comment: Why this needs documenting: 1. It's not a bug. 2. Changing this would break BC. 3. register_globals is off by default 4. register_globals will be gone in next major version. Previous Comments: ------------------------------------------------------------------------ [2008-11-05 19:55:34] php at info-svc dot com On the other hand, if register_globals is broken then extract($_FILES, EXTR_SKIP); is working as intended, skipping keys already registered. I can understand it's either a bug or a documentation problem, but something isn't right here. ------------------------------------------------------------------------ [2008-11-05 11:15:22] vrana@php.net Results of extract() shouldn't depend on register_globals. ------------------------------------------------------------------------ [2008-07-02 12:26:50] jani@php.net It's documentation issue. Plus you really should NOT be using register_globals=On. And using extract() on $_FILES...well..that's very flaky idea to begin with. Just don't do it. :) ------------------------------------------------------------------------ [2008-06-19 04:59:15] php at info-svc dot com I confirmed this behavior with PHP 5.2.6 running on IIS and Windows 2003 SP2. Test case output with register_globals Off array(5) { ["name"]=> string(14) "samplefile.txt" ["type"]=> string(10) "text/plain" ["tmp_name"]=> string(25) "C:\WINDOWS\Temp\php57.tmp" ["error"]=> int(0) ["size"]=> int(459) } string(25) "C:\WINDOWS\Temp\php57.tmp" Test case output with register_globals On string(25) "C:\WINDOWS\Temp\php58.tmp" string(1) "C" So I'm convinced that register_globals is involved here. There is something horribly wrong with this feature or its documentation. ------------------------------------------------------------------------ [2008-06-16 18:09:31] php at info-svc dot com Adding to the confusion, I thought perhaps the unexpected behavior could be caused by the register_globals configuration. However, according to documentation ... http://www.php.net/manual/en/faq.misc.php#faq.misc.registerglobals ... extract($_FILES, EXTR_SKIP); is the correct way to emulate register_globals On. I dumped all of the other superglobals and confirmed the only one containing a 'themefile' index was $_FILES. Both var_dump($_POST); and var_dump($_GET); returned "array(0) {}" ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/45283 -- Edit this bug report at http://bugs.php.net/?id=45283&edit=1

« previous php.doc.bugs (#1465) next »