Re[2]: [PHP-DEV] function proposal - php_check_syntax_string

From: Date: Fri, 18 Feb 2005 16:29:06 +0000
Subject: Re[2]: [PHP-DEV] function proposal - php_check_syntax_string
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-15095@lists.php.net to get a copy of this message
Hello Johannes, Friday, February 18, 2005, 2:17:12 PM, you wrote: JS> this patch doesn't just check wether the string has the right syntax but JS> also compiles it and registers it's functions and classes in the relevant JS> tables. well, they need to add this code to avoid it: n_old_func = zend_hash_num_elements(CG(function_table)); n_old_class = zend_hash_num_elements(CG(class_table)); /* actual compile code */ op_array = ... /* free opcode array */ #ifdef ZEND_ENGINE_2 destroy_op_array(op_array TSRMLS_CC); #else destroy_op_array(op_array); #endif efree(op_array); /* clean-up created functions */ i = 0; zend_hash_internal_pointer_reset_ex(CG(function_table), &pos); while (zend_hash_get_current_data_ex(CG(function_table), (void **)&zf, &pos) == SUCCESS) { i++; if (i > n_old_func && zf->type == ZEND_USER_FUNCTION) { zend_hash_del(CG(function_table), pos->arKey, pos->nKeyLength); } zend_hash_move_forward_ex(CG(function_table), &pos); } /* clean-up created classes */ i = 0; zend_hash_internal_pointer_reset_ex(CG(class_table), &pos); while (zend_hash_get_current_data_ex(CG(class_table), (void **)&zc, &pos) == SUCCESS) { #ifdef ZEND_ENGINE_2 zc = *((zend_class_entry**)zc); #endif i++; if (i > n_old_class && zc->type == ZEND_USER_CLASS) { zend_hash_del(CG(class_table), pos->arKey, pos->nKeyLength); } zend_hash_move_forward_ex(CG(class_table), &pos); } -- Best regards, val mailto:val@vk.kiev.ua

« previous php.internals (#15095) next »