1
0
Fork 0

possible fix for #14 "Cannot redeclare ()"

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@88 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.1
Xuefer 2006-07-09 12:47:31 +00:00
parent e771c8eaa5
commit 44d53f3c01
3 changed files with 19 additions and 4 deletions

18
utils.c
View File

@ -264,10 +264,16 @@ int xc_undo_fix_opcode(zend_op_array *op_array TSRMLS_DC) /* {{{ */
/* }}} */
#endif
void xc_install_function(char *filename, zend_function *func, zend_uchar type, char *key, uint len TSRMLS_DC) /* {{{ */
void xc_install_function(char *filename, zend_function *func, zend_uchar type, void *key, uint len TSRMLS_DC) /* {{{ */
{
if (func->type == ZEND_USER_FUNCTION) {
if (zend_u_hash_add(CG(function_table), type, key, len,
if (*(char *) key == '\0') {
zend_u_hash_update(CG(function_table), type, key, len,
func, sizeof(zend_op_array),
NULL
);
}
else if (zend_u_hash_add(CG(function_table), type, key, len,
func, sizeof(zend_op_array),
NULL
) == FAILURE) {
@ -284,7 +290,13 @@ ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, zend_u
zend_class_entry *cep = CestToCePtr(*cest);
ZESW(void *stored_ce_ptr, NOTHING);
if (zend_u_hash_add(CG(class_table), type, key, len,
if (*(char *) key == '\0') {
zend_u_hash_update(CG(class_table), type, key, len,
cest, sizeof(xc_cest_t),
ZESW(&stored_ce_ptr, NULL)
);
}
else if (zend_u_hash_add(CG(class_table), type, key, len,
cest, sizeof(xc_cest_t),
ZESW(&stored_ce_ptr, NULL)
) == FAILURE) {

View File

@ -25,7 +25,7 @@ int xc_undo_fix_opcode(zend_op_array *op_array TSRMLS_DC);
zend_uchar xc_get_fixed_opcode(zend_uchar opcode, int line);
/* installer */
void xc_install_function(char *filename, zend_function *func, zend_uchar type, char *key, uint len TSRMLS_DC);
void xc_install_function(char *filename, zend_function *func, zend_uchar type, void *key, uint len TSRMLS_DC);
ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, zend_uchar type, void *key, uint len TSRMLS_DC);
/* sandbox */

View File

@ -77,6 +77,9 @@ typedef char *zstr;
# define zend_u_hash_add(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \
zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest)
# define zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \
zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest)
# define zend_u_hash_find(ht, type, arKey, nKeyLength, pData) \
zend_hash_find(ht, arKey, nKeyLength, pData)