I am newbie in PHP. A PHP was migrated today from 5.3.3 to 5.4.4 version (Debian Squeeze to Debian Wheezy) and, after this, I get this error from Apache log :
> PHP Warning: Illegal string offset 'phptype' in xyz
The line is:
self::$conn[$dsn['phptype']] = $mdb2;
I need help to restore the system.
<?php
$a = 'Hello';
echo $a['whatever'];
?>
As some of the guys in the comments are saying, doing something like this would probably cause that error. As you can see in the example above $a
is a string rather than an array. This means that you cannot access it with a key (if however you wanted to get the 3rd letter in the string it would be ok to do $a[2]
).
You need to check that self::$conn
and $dsn
are actually arrays rather than strings. As Álvaro G. Vicario says in the comments, you can do this by dumping the variable:
var_dump(self::$conn, $dsn)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With