[PHP-DEV] Bug #10721 Updated: odd output in create_function()
ID: 10721 Updated by: zeev Reported By: [EMAIL PROTECTED] Old Status: Assigned Status: Closed Bug Type: Scripting Engine problem Operating System: GNU/Linux PHP Version: 4.0.6 Assigned To: jeroen New Comment: This odd character is quite intentional, and is there in order to ensure that any functions created don't clash with user-defined functions. You can see in the code that this extra NULL byte is accounted for and deliberately being added, it's not a coincidence :) Jereon - please don't submit this patch. Previous Comments: [2001-07-09 09:45:11] [EMAIL PROTECTED] Fixed the patch, only waiting for it to get committed. [2001-06-27 16:21:20] [EMAIL PROTECTED] Any word on this? Still exists in 4.0.6. [2001-05-07 23:10:15] [EMAIL PROTECTED] An odd character seems to appear in the return value of create_function() (which should be of 'lambda_x' format where x is an integer). This character is causing eval() to crap out when trying to evaluate the created function. Just before the 'l' is a character that looks like Pi in the browser. The only way I knew to find out what it was was to urlencode() the return value and the strange character was encoded to '%00'. I'm no C coder, but the changes below seemed to fix things. *** /tmp/zend_builtin_functions.c Mon May 7 22:09:45 2001 --- /usr/local/src/php-4.0.5/Zend/zend_builtin_functions.c Mon May 7 22:03:31 2001 *** *** 965,974 } function_add_ref(func); ! function_name = (char *) emalloc(sizeof(0lambda_)+MAX_LENGTH_OF_LONG); do { ! sprintf(function_name, %clambda_%d, 0, ++EG(lambda_count)); function_name_length = strlen(function_name+1)+1; } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); --- 965,974 } function_add_ref(func); ! function_name = (char *) emalloc(sizeof(lambda_)+MAX_LENGTH_OF_LONG); do { ! sprintf(function_name, lambda_%d, ++EG(lambda_count)); function_name_length = strlen(function_name+1)+1; } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); Edit this bug report at http://bugs.php.net/?id=10721edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Bug #10721 Updated: odd output in create_function()
Sorry for the 2nd typo - Jeroen :) At 17:09 16/7/2001, [EMAIL PROTECTED] wrote: ID: 10721 Updated by: zeev Reported By: [EMAIL PROTECTED] Old Status: Assigned Status: Closed Bug Type: Scripting Engine problem Operating System: GNU/Linux PHP Version: 4.0.6 Assigned To: jeroen New Comment: This odd character is quite intentional, and is there in order to ensure that any functions created don't clash with user-defined functions. You can see in the code that this extra NULL byte is accounted for and deliberately being added, it's not a coincidence :) Jereon - please don't submit this patch. Previous Comments: [2001-07-09 09:45:11] [EMAIL PROTECTED] Fixed the patch, only waiting for it to get committed. [2001-06-27 16:21:20] [EMAIL PROTECTED] Any word on this? Still exists in 4.0.6. [2001-05-07 23:10:15] [EMAIL PROTECTED] An odd character seems to appear in the return value of create_function() (which should be of 'lambda_x' format where x is an integer). This character is causing eval() to crap out when trying to evaluate the created function. Just before the 'l' is a character that looks like Pi in the browser. The only way I knew to find out what it was was to urlencode() the return value and the strange character was encoded to '%00'. I'm no C coder, but the changes below seemed to fix things. *** /tmp/zend_builtin_functions.c Mon May 7 22:09:45 2001 --- /usr/local/src/php-4.0.5/Zend/zend_builtin_functions.c Mon May 7 22:03:31 2001 *** *** 965,974 } function_add_ref(func); ! function_name = (char *) emalloc(sizeof(0lambda_)+MAX_LENGTH_OF_LONG); do { ! sprintf(function_name, %clambda_%d, 0, ++EG(lambda_count)); function_name_length = strlen(function_name+1)+1; } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); --- 965,974 } function_add_ref(func); ! function_name = (char *) emalloc(sizeof(lambda_)+MAX_LENGTH_OF_LONG); do { ! sprintf(function_name, lambda_%d, ++EG(lambda_count)); function_name_length = strlen(function_name+1)+1; } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); Edit this bug report at http://bugs.php.net/?id=10721edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Zeev Suraski [EMAIL PROTECTED] CTO co-founder, Zend Technologies Ltd. http://www.zend.com/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10721 Updated: odd output in create_function()
ID: 10721 Updated by: jeroen Reported By: [EMAIL PROTECTED] Old Status: Open Status: Assigned Bug Type: Scripting Engine problem Operating System: GNU/Linux PHP Version: 4.0.6 Old Assigned To: Assigned To: jeroen New Comment: Fixed the patch, only waiting for it to get committed. Previous Comments: [2001-06-27 16:21:20] [EMAIL PROTECTED] Any word on this? Still exists in 4.0.6. [2001-05-07 23:10:15] [EMAIL PROTECTED] An odd character seems to appear in the return value of create_function() (which should be of 'lambda_x' format where x is an integer). This character is causing eval() to crap out when trying to evaluate the created function. Just before the 'l' is a character that looks like Pi in the browser. The only way I knew to find out what it was was to urlencode() the return value and the strange character was encoded to '%00'. I'm no C coder, but the changes below seemed to fix things. *** /tmp/zend_builtin_functions.c Mon May 7 22:09:45 2001 --- /usr/local/src/php-4.0.5/Zend/zend_builtin_functions.c Mon May 7 22:03:31 2001 *** *** 965,974 } function_add_ref(func); ! function_name = (char *) emalloc(sizeof(0lambda_)+MAX_LENGTH_OF_LONG); do { ! sprintf(function_name, %clambda_%d, 0, ++EG(lambda_count)); function_name_length = strlen(function_name+1)+1; } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); --- 965,974 } function_add_ref(func); ! function_name = (char *) emalloc(sizeof(lambda_)+MAX_LENGTH_OF_LONG); do { ! sprintf(function_name, lambda_%d, ++EG(lambda_count)); function_name_length = strlen(function_name+1)+1; } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10721edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10721 Updated: odd output in create_function()
ID: 10721 User Update by: [EMAIL PROTECTED] Status: Open Bug Type: Scripting Engine problem Operating system: GNU/Linux PHP Version: 4.0.6 Description: odd output in create_function() Any word on this? Still exists in 4.0.6. Previous Comments: --- [2001-05-07 23:10:15] [EMAIL PROTECTED] An odd character seems to appear in the return value of create_function() (which should be of 'lambda_x' format where x is an integer). This character is causing eval() to crap out when trying to evaluate the created function. Just before the 'l' is a character that looks like Pi in the browser. The only way I knew to find out what it was was to urlencode() the return value and the strange character was encoded to '%00'. I'm no C coder, but the changes below seemed to fix things. *** /tmp/zend_builtin_functions.c Mon May 7 22:09:45 2001 --- /usr/local/src/php-4.0.5/Zend/zend_builtin_functions.c Mon May 7 22:03:31 2001 *** *** 965,974 } function_add_ref(func); ! function_name = (char *) emalloc(sizeof(0lambda_)+MAX_LENGTH_OF_LONG); do { ! sprintf(function_name, %clambda_%d, 0, ++EG(lambda_count)); function_name_length = strlen(function_name+1)+1; } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); --- 965,974 } function_add_ref(func); ! function_name = (char *) emalloc(sizeof(lambda_)+MAX_LENGTH_OF_LONG); do { ! sprintf(function_name, lambda_%d, ++EG(lambda_count)); function_name_length = strlen(function_name+1)+1; } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, func, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); --- Full Bug description available at: http://bugs.php.net/?id=10721 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]