ID: 20663 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Documentation problem Operating System: Any PHP Version: 4.2.0 New Comment:
The following fix is against ZE2: cvs -z3 -q diff zend.c (in directory S:\php4-HEAD\Zend) Index: zend.c =================================================================== RCS file: /repository/ZendEngine2/zend.c,v retrieving revision 1.193 diff -u -r1.193 zend.c --- zend.c 30 Nov 2002 11:20:25 -0000 1.193 +++ zend.c 30 Nov 2002 16:55:20 -0000 @@ -703,8 +703,6 @@ } -#define ZEND_ERROR_BUFFER_SIZE 1024 - ZEND_API void zend_error(int type, const char *format, ...) { va_list args; @@ -775,18 +773,7 @@ ALLOC_INIT_ZVAL(z_error_filename); ALLOC_INIT_ZVAL(z_error_lineno); ALLOC_INIT_ZVAL(z_context); - z_error_message->value.str.val = (char *) emalloc(ZEND_ERROR_BUFFER_SIZE); - -#ifdef HAVE_VSNPRINTF - z_error_message->value.str.len = vsnprintf(z_error_message->value.str.val, ZEND_ERROR_BUFFER_SIZE, format, args); - if (z_error_message->value.str.len > ZEND_ERROR_BUFFER_SIZE-1) { - z_error_message->value.str.len = ZEND_ERROR_BUFFER_SIZE-1; - } -#else - strncpy(z_error_message->value.str.val, format, ZEND_ERROR_BUFFER_SIZE); - /* This is risky... */ - /* z_error_message->value.str.len = vsprintf(z_error_message->value.str.val, format, args); */ -#endif + z_error_message->value.str.len = vspprintf(&z_error_message->value.str.val, 0, format, args); z_error_message->type = IS_STRING; z_error_type->value.lval = type; Previous Comments: ------------------------------------------------------------------------ [2002-11-26 17:36:19] [EMAIL PROTECTED] trigger_error silently truncates your error after 1024 chars (ZEND_ERROR_BUFFER_SIZE in the source). I didn't see this documented anywhere, so I'm reporting it as a documentation problem. I'd rather it be changed to take unlimited length strings than documented, but documenting it would be a good first step. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20663&edit=1 -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php