Re: Re: SimpleXML is creating nodes when it shouldn't...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcus Boerger wrote:
I think that's a bug and not a feature.  Why was this changed?
It is called write support. I think we are going to add a flag
so that one can specify whether write support is enabled or not.

Creating data without using '=' assignment or calling a function is scary and somewhat 'magical' behavior. When I 'read' from a SimpleXML node and cast that read into an array context, I NEVER expect to actually create an array on the object I am reading from. If I do a SET (__set), I'd be ok with the magical behavior:

   $xmlstr = "<test><item>1</item></test>";
   $xml = simplexml_load_string($xmlstr);
   $xml->nonexist = array();

But if I'm doing a GET, changing the structure of the object is very bad:

   foreach ($xml->nonexist2 as $nonexist2) {
   }

Adding a flag is fine and all, but I definitely don't want that flag to be inside an INI file.  We don't need yet another flag which causes the language to behave differently under different circumstances.  Can't you distinguish between __get and __set on the object and handle it differently that way?  If not, the flag needs to somehow be set in code and not in an INI file with the default behavior to be NO, do not enable write support.  This is a bad break in BC from such a minor version upgrade of 5.1.2 to 5.1.4.

Dante

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux