php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31217 extract($GLOBALS, EXTR_REFS) corrupts memory
Submitted: 2004-12-21 04:26 UTC Modified: 2005-03-15 01:00 UTC
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:3 (60.0%)
From: cdragon at draconic dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5CVS-2004-12-18 (dev) OS: win2k
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-12-21 04:26 UTC] cdragon at draconic dot com
Description:
------------
Since php 5.0.1, extract($GLOBALS, EXTR_REFS) seems to corrupt code memory and cause various random problems.  In my test case, it caused COM("someobject") to always return null, and in another case it just caused some strange output of a "1" instead of the expected strings.  I never had a problem in php 5.0.0 up to CVS snapshot php5.0-win32-200407301630.  Commenting out extract($GLOBALS, EXTR_REFS) fixes all strange behavior.

I had a similar problem in php 4 which I reported as bug id 25708.  That bug was fixed and I never had a problem again until 5.0.1.

Reproduce code:
---------------
  extract($GLOBALS, EXTR_REFS);
  $query = new COM("IXSSO.Query");

  if(is_object($query) == false) {
    var_dump($query);
    print "Can't create IXSSO Query object.";
    exit();
  }


Expected result:
----------------
Nothing

Actual result:
--------------
PHP has encountered an Access Violation at 01D5F185

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-19 22:10 UTC] sniper@php.net
See also bug #30074

 [2005-03-07 21:41 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-04-01 08:33 UTC] john at carney dot id dot au
I too had an issue with extract($GLOBALS,EXTR_REFS) in PHP4, but it was resolved and I haven't seen any problems again until today when I reorganised some code and suddenly I'm getting extract() problems again. I haven't got a simple script that reproduces the problem (yet), but the symptom I'm getting is when I pass a variable that is set to a definitely as a parameter to a function, null is being sent instead of the variable value. Commenting out the extract() fixes the problem (but breaks other code).
 [2005-04-01 08:35 UTC] john at carney dot id dot au
ps. this behaviour is observed in both 5.0.3 and 5.0.4
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 22:02:05 2014 UTC