The array comes from print_r($_POST, true);. $_POST is always an array and if array is empty that is the correct output you except. So basicly this means you don't send anything to as POST maybe you are using get ?
What you could do is check if anything is posted at all.
if (count($_POST) > 0) {
$info .= print_r($_POST, true);
}
If you are redirecting user to this page in case of error, the POST values won't be redirected with the user. And if this is an error catching page, maybe you should get save $_SERVER['REQUEST_URI'] along the data, so you know in which page the error happend.
Also as I said in my comment you could optimize your file writing with this.
file_put_contents($file, $info, FILE_APPEND | LOCK_EX);
It locks the file, so other scripts can't write to it at a same time, and appends the info to the end of the file. So you could replace these lines with just one command.
$current = file_get_contents($file);
$current .= $info;
file_put_contents($file, $current);
The whole script
<?php
$file = 'error_log.log';
$info = date("Y-m-d H:i:s") . " - " . $_SERVER['REQUEST_URI'] . "\n";
$info .= "POST: " . ((count($_POST))?print_r($_POST,true):"EMPTY\n");
$info .= "GET : " . ((count($_GET))?print_r($_GET,true):"EMPTY\n") . "\n";
file_put_contents($file, $info, FILE_APPEND | LOCK_EX);
Output example
2014-01-01 17:33:25 - /stack/error.php
POST: EMPTY
GET : EMPTY
2014-01-01 17:34:11 - /stack/error.php?ads=bsd&error=true
POST: EMPTY
GET : Array
(
[ads] => bsd
[error] => true
)
file_put_contents($file, $info, FILE_APPEND);Also you could just append to file so don't have to read it first, should be a little faster