Right. Schema Validation is a great example. Perhaps it can be added as a function, but here is where it gets tricky.
When I do a Schema validation on a simplexml_element, on what element does the validation happen? Schema validation happens on the root document, should it happen on the subnode that i call validate on? This can be solved with a procedural approach (requiring that you pass the root element), but can't easily be enforced with methods (unless you throw an exception in every node except the root, which is kinda counterproductive.)
It can be solved by decision. I'd prefer it to only run on the root but I don't think it's that horrible if it'd also work on a sub-node. Could actually be useful. Anyway, if it will only work on the node you can throw an E_ERROR and don't have to throw an exception.
> >> Also, it's great you've finally woken up, but it's a bit late in the game
> >> to be doing so. We are in a feature freeze now so that we can get RC1 out
> >> of the door hopefully by the end of the month, and it just doesn't make
> >> sense to redesign the whole thing now.
> >
> >Well, its not a feature freeze, and this doesn't require a full
> >redesign. As you know removing methods from a class entry is not at all
> >hard. Neither is changing two methods into functions. Much more
> >grotting of the internals could be done in the future, but the entire set
> >of
> >userspace changes (which are important for 5.0) can be done without any
> >terribly
> >invasive changes.
>
> I don't mind getting some cosmetic changes into RC1. However, I still think
> that not all methods should be made functions.
>
Well, which should remain?
In any case, we should go studlyCaps because that's what we decided to use for methods, for better or for worse.
I haven't used register_ns nor xsearch so I suggest others reply. What they think they will use and is useful and what is bloat.
Sure. But I use php_error(E_WARNING) not exceptions. We can certainly discuss how it is and isn't pure OO, and what that means. OO people are still arguing that... In fact I read a paper on OO the other day that said instantiable class should have no external methods (which is bollocks).
No one said that you should use exceptions. Actually there was pretty much a decision that we're not moving to exceptions from internal functions. Some extension authors of new OO extensions prefer throwing exceptions so that was their decision (which is causing quite a lot of problems which I still need to look into). The whole exceptions thingy is quite problematic right now.
At the end of the day its what works best for the API. And in the case of SimpleXML which has a rather messed up structure, something like a array/balanced tree hybrid, most utility methods make better sense as functions. And access methods shouldn't exist, its not the point of simplexml.
> >> So after all this ranting what I really think we should be discussing > >is if > >> there are any *crucial* things which need changing or fixing without > >> redesigning the whole thing. > >> > > > >It was never "redesigned." People added work while i was sleeping > >(since I woke up after all), this work happens to be contrary to the > >point of the extension. That's why I'm writing in disagreement. > > I think the people who continued your work have done a good job in keeping > things simple. And I don't think the point of the extension has been lost. > By the way, did you following problem: > > Due to engine problems it is currently not possible to access > a subelement by index 0: $object->property[0]. >
Yes.
> Any constructive ideas on fixing it? The following was a proposed fix by > Dmitry but I don't think it quite cut it:
Its in there. Its not yet fixed either:
<?php $XML = <<<EOX <?xml version="1.0"?> <names> <name> <first>Joe</first> </name> </names> EOX;
$names = simplexml_load_string($XML); $names->name[0]->first = 'John'; echo $names->name[0]->first; ?>
Will segfault. I can trace it back to an engine problem, although I haven't gotten into analyzing it yet. I'll take a look at in the following days (amongst other things), do you have an idea as to the reason its failing?
Nope, I didn't look into it. I think Marcus and Dmitry have looked into it. Try and take another look if you can.
Andi
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php