I have a strange issue and I can't find why is it happening. Some background first. I have a symfony 1.4 application installed on about 10 production servers. They all run PHP 5.3.0 but I'm not sure if all are configured in the same way (it depends on the admins and I'm familiar with parts of the php.ini file only). So... A strange error was reported a few days ago on one of the servers. After each call of the forward method in an action class (the only important thing about it to symfony non-familiar people is that it does things and throws a sfStopException which inherits the sfException class) a "Fatal error: Only variables can be passed by reference" error is generated. I've searched the web for the reason and here is what I've found - http://the-stickman.com/web-development ... reference/. I think this post describes perfectly the problem and the solution. It's all fine so far - nothing strange... Until I saw where the error was generated - .../lib/vendor/symfony/lib/exception/sfException.class.php on line 293 which stands for this method:
Code: Select all
/**
* Returns an excerpt of a code file around the given line number.
*
* @param string $file A file path
* @param int $line The selected line number
*
* @return string An HTML string
*/
static protected function fileExcerpt($file, $line)
{
if (is_readable($file))
{
$content = preg_split('#<br />#', highlight_file($file, true)); // THIS LINE GENERATES THE ERROR
$lines = array();
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++)
{
$lines[] = '<li'.($i == $line ? ' class="selected"' : '').'>'.$content[$i - 1].'</li>';
}
return '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
}
}