#20663 [Opn->Csd]: dealing with error size limits
| From: | vrana@php.net | Date: | Tue, 27 Jul 2004 12:55:58 +0000 |
| Subject: | #20663 [Opn->Csd]: dealing with error size limits | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969362228@lists.php.net to get a copy of this message | ||
ID: 20663
Updated by: vrana@php.net
Reported By: swbrown at ucsd dot edu
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Any
PHP Version: 4.2.0
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"This length is applied to logged errors, displayed errors and also to
$php_errormsg."
Previous Comments:
------------------------------------------------------------------------
[2003-01-21 22:27:04] philip@php.net
Reopening (changing topic) until someone figures out and documents:
a) If this limit is affected by the log_errors_max_len directive, which
defaults to 1024.
b) If this directive and/or limit affects $php_errormsg.
Changing summary->dealing with error size limits
Also if the answer is no to either (a) and/or (b), why?
------------------------------------------------------------------------
[2003-01-20 14:48:13] pollita@php.net
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.
------------------------------------------------------------------------
[2003-01-20 14:41:55] derick@php.net
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] pollita@php.net
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] helly@php.net
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;
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/20663
--
Edit this bug report at http://bugs.php.net/?id=20663&edit=1