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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to