Jiggmin's Village
Must be a string, string given - Printable Version

+- Jiggmin's Village (https://jiggmin2.com/forums)
+-- Forum: Turing Machines (https://jiggmin2.com/forums/forumdisplay.php?fid=19)
+--- Forum: Coding and Development (https://jiggmin2.com/forums/forumdisplay.php?fid=20)
+--- Thread: Must be a string, string given (/showthread.php?tid=2469)



Must be a string, string given - bls1999 - 24th April 2020

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.