Changeset 1562 in svn


Ignore:
Timestamp:
2014-11-10T13:24:52Z (4 years ago)
Author:
Xuefer
Message:

PHP4: fix object handling

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/var-helper.h

    r1561 r1562  
    4545    }
    4646
    47     next_index = xc_vector_size(&processor->class_names);
     47    /* HashTable <=PHP_4 cannot handle NULL pointers, +1 needed */
     48    next_index = xc_vector_size(&processor->class_names) + 1;
    4849    if (zend_hash_add(&processor->class_name_to_index, ce->name, ce->name_length, (void *) &next_index, sizeof(next_index), NULL) == SUCCESS) {
    4950        xc_constant_string_t class_name;
     
    6061    if (zend_hash_find(&processor->class_name_to_index, ce->name, ce->name_length, (void **) &index) != SUCCESS) {
    6162        php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "Internal error: class name not found in class names");
    62         return (size_t) -1;
     63        return (size_t) - 1;
    6364    }
    6465
    65     return *index;
     66    return *index - 1;
    6667}
    6768/* }}} */
  • trunk/xcache/xc_utils.c

    r1561 r1562  
    648648#elif defined(ZEND_ENGINE_2)
    649649    if (zend_lookup_class_ex(class_name, class_name_len, autoload, &cest TSRMLS_CC) != SUCCESS) {
    650         return NULL;
    651     }
    652 #else
    653     if (zend_hash_find(EG(class_table), class_name, class_name_len, (void **) &cest) != SUCCESS) {
    654         return NULL;
    655     }
    656 #endif
    657     return CestToCePtr(*cest);
    658 }
    659 /* }}} */
     650        cest = NULL;
     651    }
     652#else
     653    char *lc_class_name;
     654    ALLOCA_FLAG(use_heap);
     655
     656    lc_class_name = xc_do_alloca(sizeof(*class_name) * (class_name_len + 1), use_heap);
     657    strcpy(lc_class_name, class_name);
     658    zend_str_tolower(lc_class_name, class_name_len);
     659
     660    if (zend_hash_find(EG(class_table), lc_class_name, class_name_len + 1, (void **) &cest) != SUCCESS) {
     661        cest = NULL;
     662    }
     663    xc_free_alloca(lc_class_name, use_heap);
     664#endif
     665    return cest ? CestToCePtr(*cest) : NULL;
     666}
     667/* }}} */
Note: See TracChangeset for help on using the changeset viewer.