Bug #54232 [Opn->Fbk]: Crashes with magic method __set()
| From: | felipe@php.net | Date: | Fri, 11 Mar 2011 22:34:26 +0000 |
| Subject: | Bug #54232 [Opn->Fbk]: Crashes with magic method __set() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-159417@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54232&edit=1
ID: 54232
Updated by: felipe@php.net
Reported by: rantes dot javier at gmail dot com
Summary: Crashes with magic method __set()
-Status: Open
+Status: Feedback
Type: Bug
-Package: Compile Failure
+Package: Scripting Engine problem
Operating System: winxp
PHP Version: 5.2.17
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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] felipe@php.net
Btw, try using PHP 5.3.6RC3 or svn version.
------------------------------------------------------------------------
[2011-03-11 22:10:53] felipe@php.net
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 http://bugs.php.net/bug.php?id=54232&edit=1