php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34505 Possible memory corruption.
Submitted: 2005-09-15 00:49 UTC Modified: 2005-09-20 13:21 UTC
From: stochnagara at hotmail dot com Assigned: tony2001 (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-09-15 (snap) OS: windows xp
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: stochnagara at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-09-15 00:49 UTC] stochnagara at hotmail dot com
Description:
------------
I know that the code below is senseless in this form, but I came across it accidentally.

This code prodcues a dump of $b object variable which contains two members - 'd' and a strange member shown as ':private'. The name is ':private' when the last line is not present. When this line (echo $a->{4} or similar) is put in the script, var_dump ($b) starts to produce a different dump on each script run. A sample output is shown below.

Reproduce code:
---------------
<?
$a['d'] = 4;
$a[''] = 5;
$b =(object)$a;
var_dump($b);
echo $a->{4};


Expected result:
----------------
Maybe

object(stdClass)#1 (2) { array (['d'] => int(4), [''] => int(5)) }

Actual result:
--------------
A sample result is

object(stdClass)#1 (2) { ["d"]=>  int(4) ["?:private"]=>  int(5) }

But '?' is often another symbol or a sequence of symbols. Also it is sometimes just [":private"].

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-15 01:01 UTC] tony2001@php.net
Assigned to myself.
IIRC I have even cooked a patch for it, but didn't apply for a reason.
 [2005-09-20 13:21 UTC] tony2001@php.net
Fixed in 5.1, I'll merge the fix to 5.0 & HEAD soon.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC