Re: do_bind_inherited_class()

From: Date: Sun, 15 Jan 2006 13:31:19 +0000
Subject: Re: do_bind_inherited_class()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-21541@lists.php.net to get a copy of this message
What exactly are you trying to fix? On 15.01.2006 16:15, Tim Starling wrote:
I was just browsing the PHP source and I noticed something apparently amiss. The top of do_bind_inherited_class() in Zend/zend_compile.c reads:
    found_ce = zend_u_hash_find(class_table, Z_TYPE(opline->op1.u.constant),
Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (void **) &pce);
    if (found_ce == FAILURE) {
        if (!compile_time) {
            /* If we're in compile time, in practice, it's quite possible
             * that we'll never reach this class declaration at runtime,
             * so we shut up about it.  This allows the if (!defined('FOO'))
{ return; }
             * approach to work.
             */
            zend_error(E_COMPILE_ERROR, "Cannot redeclare class %R",
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
        }
        return NULL;
    } else {
        ce = *pce;
    }
Shouldn't that be
    found_ce = zend_u_hash_find(class_table, Z_TYPE(opline->op1.u.constant),
Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), (void **) &pce);
    if (found_ce == FAILURE) {
        zend_error(E_COMPILE_ERROR, "Internal Zend error - Missing class
information for %R", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant));
        return NULL;
    } else {
        ce = *pce;
    }
same as do_bind_class()? I'll submit that as a proper patch if you prefer. -- Tim Starling
-- Wbr, Antony Dovgal

« previous php.internals (#21541) next »