Edit report at https://bugs.php.net/bug.php?id=54232&edit=1

 ID:               54232
 Updated by:       [email protected]
 Reported by:      rantes dot javier at gmail dot com
 Summary:          Crashes with magic method __set()
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          Scripting Engine problem
 Operating System: winxp
 PHP Version:      5.2.17

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2011-03-11 23:34:24] [email protected]

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

I can't reproduce it.

------------------------------------------------------------------------
[2011-03-11 22:19:39] rantes dot javier at gmail dot com

I can not use P.H.P. > 5.2.9 beecause the server is not mine and its a paid 
server. I have to fix to this requirement.

------------------------------------------------------------------------
[2011-03-11 22:12:34] [email protected]

Btw, try using PHP 5.3.6RC3 or svn version.

------------------------------------------------------------------------
[2011-03-11 22:10:53] [email protected]

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.



------------------------------------------------------------------------
[2011-03-11 22:07:53] rantes dot javier at gmail dot com

Description:
------------
I'm developing an OOP FrameWork and i'm improving ActiveRecord. My AR class 
extends from ArrayObject Class from PHP and when i try to set an AR Object into 
another, mixing the _data array between normally vars and an AR, PHP crushes 
and 
server crash.

If i do this:

class ActiveRecord extends ArrayObject{
  public function __set($name, $value) {
        $this->_data[$name] = $value;
  }
}

class A extends ActiveRecord{
  public function __construct(){
  }
}

class B extends ActiveRecord{
  public function __construct(){
  }
}

$A = new A;
$B = new B;

$A->foo = 3; // everything alright, no crushes.
$B->var = 4; // everything alright, no crushes.

$B->A = $A; // Crush!!!!

When i tried this, the server goes down, but i figured out to use another array 
for the AR objects apart from the $_data array and its works.

This works:


public function __set($name, $value) {
  if(is_object($value) and strcmp(get_parent_class($value),'ActiveRecord')===0):
    $this->_models[$name] = $value;
  else:
    $this->_data[$name] = $value;
  endif;
}


So, why does it happens??



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=54232&edit=1

Reply via email to