1K is too low for PHP to render the error in the browser.
[Updated]
PHP needs to have enough memory available in order to be able to trigger the error handler that displays the error messages in the browser. So in this case, php did not have enough memory when it tried to output the message to the browser and just stopped.
The amount of memory required depends on loaded extensions, server environment, and other php.ini settings.
For example, when an out of memory error is triggered at 1 MB allocated, it requires 1.5 MB in order to display an error message in the browser. See: Tracking Memory Usage in PHP
Demo: http://ideone.com/VmPO0w
<?php
// error.php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$x = str_repeat(' ', 1024 * 1024); //store 1 MB to a string
ini_set('memory_limit', '1535K'); //minimum of 1536K (1.5 MB) needed to display error
while (true) {
echo 'not real: ' . (memory_get_peak_usage(false) / 1024 / 1024) . " MB\n";
echo 'real: ' . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\n\n";
$x .= str_repeat(' ', 1024 * 500); //store 500K more to string
}
Command line usage result: $>php error.php
not real: 1.2208786010742 MB
real: 1.5 MB
Fatal error: Allowed memory size of 1571840 bytes exhausted (tried to allocate 512001 bytes) in error.php on line 10
While when loaded in the browser, the result would be a blank page.
Windows Environment php 5.6 x64 NTS + built-in webserver. Use at least 256K
.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
echo $error->abc; // should give error
// E_ERROR - run out of memory
ini_set('memory_limit', '256K'); //tested with 255K - blank page
var_dump((object) range(0, 100000));
( ! ) Fatal error: Allowed memory size of 262144 bytes exhausted
(tried to allocate 32 bytes) in ...
Linux Environment php 5.6 x64 NTS + php-fpm + Apache FCGI. Use at least 512K
.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
echo $error->abc; // should give error
// E_ERROR - run out of memory
ini_set('memory_limit', '512K'); //test with 511K - blank page
var_dump((object) range(0, 100000));
( ! ) Fatal error: Allowed memory size of 524288 bytes exhausted
(tried to allocate 32 bytes) in ...