ID: 20663 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Any PHP Version: 4.2.0 New Comment:
This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Actually there are some problems with that patch (re: Derick/Iliaa). For the present time trigger_error will continue to only accept 1024 character messages. Documentation updated to reflect limit. Previous Comments: ------------------------------------------------------------------------ [2003-01-20 14:41:55] [EMAIL PROTECTED] The attached patch is not valid, cause a) it doesn't work (it keeps limiting at 1024 bytes) b) vspprintf is in PHP space, not Zend and c) it might be a bad idea to have unlimited error lenghts because it might be exploited in someway. Derick ------------------------------------------------------------------------ [2003-01-20 14:29:20] [EMAIL PROTECTED] Helly- Are you (or someone else) planning on committing that patch? I see you wrote it against rev 1.193, but zend.c is up to 1.205 and the old code (using ZEND_ERROR_BUFFER_SIZE) is still there. I'd like to put a note on trigger_error()s doc page, but if it is indeed going to be patched (with PHP 5.0)the note should also say that. Although I just noticed you don't have karma for ZE2 either :) Anyone else intending to apply this patch or something similar? ------------------------------------------------------------------------ [2002-11-30 12:43:47] [EMAIL PROTECTED] 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; ------------------------------------------------------------------------ [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