Re: Studlycaps and MySQLi

From: Date: Wed, 24 Mar 2004 05:06:54 +0000
Subject: Re: Studlycaps and MySQLi
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-8731@lists.php.net to get a copy of this message
On Mar 23, 2004, at 11:21 PM, Adam Maccabee Trachtenberg wrote:
On Tue, 23 Mar 2004, Rasmus Lerdorf wrote:
they are all in sync. For example, Derek Ford's simplexml-related message to internals last week(*) worries me somewhat. He passed on what looks to be some basic brokeness in the extension which nobody has addressed so far. (*) http://news.php.net/article.php?group=php.internals&article=8660
Here's my take on these issues: 1: You can't tell if an element exists or not
OK. So I haven't really looked at this code before, but a cursory inspection leads me to believe that sxe_prop_dim_exists() doesn't work right at all for elements. When you come in testing for the existence of $obj->element, node is set to the xmlNodePtr for $obj (which exists of course). Then you fall into this case:
        if (elements) {
            if (Z_TYPE_P(member) == IS_LONG) {
                if (sxe->iter.type == SXE_ITER_CHILD) {
                    node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
                }
                node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node);
            }
            if (node) {
                exists = 1;
            }
        }
I don't see where this actually looks up 'element', it seems like it simply evaluates the existence of node. I committed a fix, but someone who knows the code better should validate that it is correct.

« previous php.internals (#8731) next »