note 108789 added to class.arrayobject

From: Date: Thu, 24 May 2012 21:41:15 +0000
Subject: note 108789 added to class.arrayobject
Groups: php.notes 
Request: Send a blank email to php-notes+get-188209@lists.php.net to get a copy of this message
Nice hack by php5 dot man at lightning dot hu I was trying to extend it and found that if you delete substr condition, it gives you access to all functions and callbacks ofc it is not so safe, but gives extra magic methods access for example: class MyArrayObject extends ArrayObject { public function __call($func, $argv) { if (!is_callable($func) ) throw new BadMethodCallException(__CLASS__.'->'.$func); return call_user_func_array($func, array_merge(array($this->getArrayCopy()), $argv)); } public function __set($key, $val) { return $this[$key]===false ? $this->offsetSet($key,$val) : $this[$key]=$val; } } dunno what to add at __set when you can callbacking all over the functions. ps also care about single argument passed to __call() ---- Server IP: 195.54.192.44 Probable Submitter: 95.221.51.212 ---- Manual Page -- http://www.php.net/manual/en/class.arrayobject.php Edit -- https://master.php.net/note/edit/108789 Del: integrated -- https://master.php.net/note/delete/108789/integrated Del: useless -- https://master.php.net/note/delete/108789/useless Del: bad code -- https://master.php.net/note/delete/108789/bad+code Del: spam -- https://master.php.net/note/delete/108789/spam Del: non-english -- https://master.php.net/note/delete/108789/non-english Del: in docs -- https://master.php.net/note/delete/108789/in+docs Del: other reasons-- https://master.php.net/note/delete/108789 Reject -- https://master.php.net/note/reject/108789 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188209) next »