|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-03-11 22:10 UTC] felipe@php.net
-Status: Open
+Status: Feedback
[2011-03-11 22:10 UTC] felipe@php.net
[2011-03-11 22:12 UTC] felipe@php.net
[2011-03-11 22:19 UTC] rantes dot javier at gmail dot com
-Status: Feedback
+Status: Open
[2011-03-11 22:19 UTC] rantes dot javier at gmail dot com
[2011-03-11 23:34 UTC] felipe@php.net
-Status: Open
+Status: Feedback
-Package: Compile Failure
+Package: Scripting Engine problem
[2011-03-11 23:34 UTC] felipe@php.net
[2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 04:00:01 2025 UTC |
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??