|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
36 + 42 = ?
Subscribe to this entry?

 [2005-09-15 00:49 UTC] stochnagara at hotmail dot com
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;
echo $a->{4};

Expected result:

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"].


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-15 01:01 UTC]
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]
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: Tue Apr 16 11:01:29 2024 UTC