I sometimes have a problem that allows the web browser to display the message “Zero response size” (Firefox). Chrome displays "ERR_EMPTY_RESPONSE". I am using CodeIgniter (still version 2.xx).
In the call, I check some post variables, insert a database record and send an email. However, the email method downloads the language file for the log message. At the end of this call in the /core/Lang.php class system, the file is included and the array of classes is expanded.
The next line (Lang.php, line 126) executes the following statement:
$this->is_loaded[] = $langfile;
The array is initialized, and this is usually normal. But in this special case, this is the exact line that causes the PHP server to crash (my explanation for the empty answer I get).
Now I am running PHP 5.5.19, but the error also appears from 5.2.17.
Any explanation why this is happening? If I try to reproduce the error by assigning the variable in the same way, I never get the same message. Also, the only similarity in cases where I get this error is that I sent mail earlier.
Update : here PHP_INFO: http://awesumgrades.ch/phpinfo.php
Update 2 : here is what I tried for sure:
I tried to reset everything to this line:
var_dump($this->is_loaded); var_dump($langfile); exit("I reached here"); $this->is_loaded[] = $langfile;
Getting this result:
array(0) { } string(14) "email_lang.php" I reached here
Now when I do this (put the array job in front):
$this->is_loaded[] = $langfile; var_dump($this->is_loaded); var_dump($langfile); exit("I reached here");
I get ERR_EMPTY_RESPONSE (chrome).
When I dump $this , this is an object:
object(CI_Lang)#11 (2) { ["language"]=> array(0) { } ["is_loaded"]=> array(0) { } }
When I return to the calling function, I got the following lines (in core / libraries / Email.php):
protected function _set_error_message($msg, $val = '') { $CI =& get_instance() $CI->lang->load('email');
I put the following lines in front of the email downloader:
$CI =& get_instance(); var_dump($this); var_dump($CI); exit(); $CI->lang->load('email');
This displays the entire object that I cannot publish here for the security reasons of my site. If you need a specific property or part of an object, I will provide it here.
Currently, I am still waiting for the Apache log from my hoster, if it is here, I will publish it.
Update 3 . I just tried to just comment out the line again, but then the script crashes in the next line, which clarifies that the accident is absolutely not related to the logic of the Lang.php class, but this seems to be a mistake of a larger class (I tried to print the memory, but I do not have permission for memory_get_usage() ....
FINAL UPDATE
I finally got to my hoster, which provided me with apache error logs, but there were no hints of the specified error.
However, now the magic is complete: after smcjones' answer I added a line
ini_set('display_errors', 1);
in the very first line in CI index.php and set error_reporting to E_ALL again. However, as soon as I run the code with this set of lines, the error will not be repeated - even if I set display_errors to 0 . When I comment the line again, the error will be repeated. Also, when I delete error_reporting(E_ALL) , an error occurs despite ini_set .....
I had no idea what was changing with these lines, but it looks like with a call to ini_set () and error_reporting, maybe some routine might turn on, which was missing otherwise - I don't know.
It once again indicates how the magic of PHP can sometimes be - it never ceases to amaze me.