note 123241 added to function.error-log
| From: | Sion@php.net | Date: | Thu, 18 Oct 2018 14:48:04 +0000 |
| Subject: | note 123241 added to function.error-log | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209461@lists.php.net to get a copy of this message | ||
DO NOT try to output TOO LARGE texts in the error_log();
if you try to output massive amounts of texts it will either cut of the text at about 8ooo
characters (for reasonable massive strings, < 32 K characters) or (for insanely massive strings,
about 1.6 million characters) totally crash without even throwing an error or anything (I even put
it in a try/catch without getting any result from the catch).
I had this problem when I tried to debug a response from a wp_remote_get(); all of my error_log()
worked as they should, except for ONE of them... (-_-)
After about a day of debugging I finally found out why & that's why I type this.
Apparently the response contained a body with over 1.6 million chars (or bytes? (whatever strlen()
returns)).
If you have a string of unknown length, use this:
$start_index = 0;
$end_index = 8000;
error_log( substr( $output_text , $start_index , $end_index ) );
----
Server IP: 208.43.231.9
Probable Submitter: 2001:2040:70:16:da2:c4d5:1a83:b4ff
----
Manual Page -- http://php.net/manual/en/function.error-log.php
Edit -- https://master.php.net/note/edit/123241
Del: integrated -- https://master.php.net/note/delete/123241/integrated
Del: useless -- https://master.php.net/note/delete/123241/useless
Del: bad code -- https://master.php.net/note/delete/123241/bad+code
Del: spam -- https://master.php.net/note/delete/123241/spam
Del: non-english -- https://master.php.net/note/delete/123241/non-english
Del: in docs -- https://master.php.net/note/delete/123241/in+docs
Del: other reasons-- https://master.php.net/note/delete/123241
Reject -- https://master.php.net/note/reject/123241
Search -- https://master.php.net/manage/user-notes.php