Web lists-archives.com

Re: [PHP] Meaning of error?





On Nov 12, 2015, at 11:23 AM, Ryan Pallas wrote:

On Thu, Nov 12, 2015 at 12:18 PM, Jeffry Killen <jekillen@xxxxxxxxxxx>
wrote:

Hello;

I have  been getting this error:

<b>Warning</b>:  Illegal string offset 'file' in
<b>(path)/dev_lab_current/php/console_proc.php</b> on line <b>69</ b><br /> This error, with the markup, is appearing the the top of the page that is
supposed to display processing results.

The line number represents this code:

if(!self::$_input['file'])

self::$_input must be a string not an array, therefore only numeric offsets are allows when dereferencing the variable. I would double check its what
you expect it to be with var_dump, a debugger, or similar debugging
techniques.

Thank you for your input.
self::$_input is a static class variable that is initiated as an array and
set to $_POST vars when  __construct() is run.

As it turns out, using if(!isset(self::$_input['file'])) does the trick.
I happened to find that out as an experiment to see if it was because
there was nothing in the self::$_input array. That appears to be the case. I must have been getting this error all along and didn't notice it because
of the markup displayed in a dark background.

JK



Why would 'file' be an illegal string offset? Is it literally illegal or
is there some other reason for this error?

This is the first time I have seen this.

Thanks for time and attention:
JK

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php