Question

First time in a long time since I've used PHP with IIS, however I've hit a bit of a deadlock when it comes to this line

if($this->debug) var_dump($this->_handle->error . " L" . debug_backtrace()[0]["line"]);

On my Debian development box - this will work perfectly (albeit not the best coding style in the world)

However on the Server 2008 R2 box with PHP5.3 + IIS 7 + FastCGI running, it will throw a parse error Parse error: syntax error, unexpected '[' in C:\inetpub\linkfinder\dev\dbhandler.php on line 94

My PHP.ini similar between the two boxes through running a diff against them.

I will be also modifying the code today across the project to move away from this coding style but I was interested in if it is this a common limitation of PHP in IIS or am I missing a config setting?

Was it helpful?

Solution

You are trying to do function array dereferencing which is the latest feature(s) of PHP 5.4 and not available on PHP 5.3.

You need to rewrite like this for that to work..

<?php
if($this->debug) {
   $backtrace = debug_backtrace();
   var_dump($this->_handle->error . " L" . $backtrace[0]["line"]);
}
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top