Re: [PHP-DEV] SimpleXML & Casting to String

2004-02-29 Thread Andi Gutmans
At 12:36 29/02/2004 -0500, Sterling Hughes wrote: The problem is that user-land overloading can't be supported. C extensions might be able to be supported but I don't think it's a good idea to start hacking this into PHP. It wouldn't end at the comparison operator but people would want it to wo

Re: [PHP-DEV] SimpleXML & Casting to String

2004-02-29 Thread Sterling Hughes
On Feb 29, 2004, at 12:31 PM, Andi Gutmans wrote: At 12:20 29/02/2004 -0500, Sterling Hughes wrote: On Feb 29, 2004, at 12:03 PM, Andi Gutmans wrote: I think there isn't a problem with "echo" as it will call the string handler. However, in other cases it might be problematic. Maybe a solution i

Re: [PHP-DEV] SimpleXML & Casting to String

2004-02-29 Thread Andi Gutmans
At 12:20 29/02/2004 -0500, Sterling Hughes wrote: On Feb 29, 2004, at 12:03 PM, Andi Gutmans wrote: I think there isn't a problem with "echo" as it will call the string handler. However, in other cases it might be problematic. Maybe a solution is to implement an equals function so that people wo

Re: [PHP-DEV] SimpleXML & Casting to String

2004-02-29 Thread Sterling Hughes
On Feb 29, 2004, at 12:03 PM, Andi Gutmans wrote: I think there isn't a problem with "echo" as it will call the string handler. However, in other cases it might be problematic. Maybe a solution is to implement an equals function so that people would do: if ($doc->name->equals("Hello")) ? I don'

Re: [PHP-DEV] SimpleXML & Casting to String

2004-02-29 Thread Andi Gutmans
I think there isn't a problem with "echo" as it will call the string handler. However, in other cases it might be problematic. Maybe a solution is to implement an equals function so that people would do: if ($doc->name->equals("Hello")) ? I don't think we can support auto-string conversion transp

Re: [PHP-DEV] SimpleXML & Casting to String

2004-02-27 Thread Sterling Hughes
BP_VAR_R just tells the engine not to through a warning when the property doesn't exist. The problem is that we need to handle cases like: $doc = simplexml_load_string('bar'); echo $doc->name["attr"]; echo $doc->name; Both would be covered by BP_VAR_R AFAIR. What if the string is empty and th

Re: [PHP-DEV] SimpleXML & Casting to String

2004-02-27 Thread Andi Gutmans
Basically SimpleXML should know if the property is being fetched for read or not (type is passed such as BP_VAR_R or BP_VAR_W). If the case is BP_VAR_R (read access) then SimpleXML should return the value and not an object. There might be some places in the engine which aren't covered but it's b

Re: [PHP-DEV] SimpleXML & Casting to String

2004-02-27 Thread Marcus Boerger
Hello Adam, Friday, February 27, 2004, 7:37:15 PM, you wrote: > I know we discussed this already, but after seeing a couple of bug > reports about SimpleXML, I'm worried our decision only makes sense to > us and not to regular users. :) > Specifically, since elements and attibutes look like stri

[PHP-DEV] SimpleXML & Casting to String

2004-02-27 Thread Adam Maccabee Trachtenberg
I know we discussed this already, but after seeing a couple of bug reports about SimpleXML, I'm worried our decision only makes sense to us and not to regular users. :) Specifically, since elements and attibutes look like strings, people expect them to act like strings. But since they're not objec