php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25957 bad one? mixingup of array / $this-> in memory
Submitted: 2003-10-22 17:32 UTC Modified: 2003-12-04 02:23 UTC
From: sven at leon dot uia dot mx Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.0b1 (beta1) OS: All (redhat 90)
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sven at leon dot uia dot mx
New email:
PHP Version: OS:

 

 [2003-10-22 17:32 UTC] sven at leon dot uia dot mx
Description:
------------
In a class I send an array $test as a parameter to a protected function. Then, if I try to access that array in any way in that function, suddenly the $this object contains the data of that array $test (!)

Reproduce code:
---------------
Sorry, cant make a short-and-clear reproducing code, but here I have a small code sample that actually caused the problem: (note that $this->params["source"] _IS_ an array)

protected function get_body($css){

echo "B0 (";
print_r($this);
echo ")<br>";
flush();

  $retval="";
  while(list($key, $cell_data)=each($this->params["source"])){

  echo "B1 (";
  print_r($this);
  echo ")<br>";
  flush();



Expected result:
----------------
I will try to get a .zip together with the classes that seem to cause this problem.

Actual result:
--------------
B0 (table_key_value_a Object ( [params:protected] => Array ( [source] => Array ( [crc] => mBjsS50UkhAnxjWp [sid] => 75 [test_site] => 75,mBjsS50UkhAnxjWp ) [col headers] => Array ( [0] => Key [1] => Value ) [table header] => HTTP VARIABLES [css prefix] => debug [table header extra] => align='center' ) ) )

B1 (table_key_value_a Object ( [cell_data] => mBjsS50UkhAnxjWp [key] => crc ) )

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-27 12:51 UTC] sven at leon dot uia dot mx
Sorry for late update.

I think I have found the cause of the problem, if you have 2 objects, 1 is parent, other is child, en in both you have defined the __destruct() function, and you call the childs __destruct() function, then stuff gets really mixed up...

for the rest I have had _no_ problem yet, GREAT JOB PHP5!! :)
 [2003-11-28 20:35 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.


 [2003-12-04 02:23 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Nov 29 14:04:16 2022 UTC