Jiggmin's Village

Full Version: Must be a string, string given
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was helping a friend with some PHP. It was working fine on my computer but failing with no errors on his. I told him to add the debugging code listed below to show the errors:

PHP Code:
ini_set('display_errors'1);
ini_set('display_startup_errors'1);
error_reporting(E_ALL E_STRICT); 

Upon adding, his machine threw this error:

Catchable fatal error: Argument 1 passed to myFunction() must be an instance of string, string given, called in /file.php on line 88 and defined in /file.php on line 49

So basically, PHP was requiring a string... but throwing an error when a string was passed. Nice job PHP.

Advice: always sync your PHP versions across dev environments! This was due in part to specifying a type declaration in an older version of PHP than I was using.