![]() |
Codeigniter not showing helpful error messgaes - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Codeigniter not showing helpful error messgaes (/showthread.php?tid=77717) |
Codeigniter not showing helpful error messgaes - Ceo - 10-09-2020 Codeigniter normally used to show helpful error messages but for some unknown reasons, all it shows is Uncaught ErrorException: htmlspecialchars() expects parameter 1 to be string, resource given in C:\xampp\htdocs\app\Views\errors\html\error_exception.php:182 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'htmlspecialchar...', 'C:\\xampp\\htdocs...', 182, Array) #1 C:\xampp\htdocs\app\Views\errors\html\error_exception.php(182): htmlspecialchars(Resource id #23, 8, 'UTF-8') #2 C:\xampp\htdocs\system\Debug\Exceptions.php(299): include('C:\\xampp\\htdocs...') #3 C:\xampp\htdocs\system\Debug\Exceptions.php(172): CodeIgniter\Debug\Exceptions->render(Object(ParseError), 500) #4 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ParseError)) #5 {main} thrown I have NO idea what is going on.Whether it is a parse error, synat error etc, that is all it ever shows now.Please help Ps: this happened after installing some composer pacakages RE: Codeigniter not showing helpful error messgaes - captain-sensible - 10-09-2020 ok well somewhere you are using: Code: htmlspecialchars($input,ENT_QUOTES ,'UTF-8',True); so as you can see in the example above the first parameter passed has to be a string. Funny enough i've just been playing with along with esc(); So say you have a form with a text input called 'title' and you get the text typed into that text box in a controller using : Code: $title = $this->request->getVar('title'); well you might want to process it and change a double quotation to " then its along the lines of: Code: htmlspecialchars($title,ENT_QUOTES ); Now for max info open up Logger.php located app/Config and set to 9 Make sure in .env : CI_ENVIRONMENT = development or if your not using that but in index.php in public $_SERVER['CI_ENVIRONMENT'] = 'development'; Do you have the tool bar showing bottom of web page ? image shows what error i get , tells me line 20 where i put an integer of 1 RE: Codeigniter not showing helpful error messgaes - paulbalandan - 10-10-2020 The error is clear. You are passing a resource type as the first parameter of htmlspecialchars, which usually accepts a string. Please check the variable you are passing to the first param. Ok. Scrap my last comment. The error is from the built in error exception file. Do you have somewhere in your code that you defined a constant equivalent to a resource? Something like define('STREAM', STDOUT); or define('MY_FILE', fopen('path/to/file', 'rb')); The problem is that the file is printing all defined constants and escaping them using htmlspecialchars. But somewhere a user defined constant is set to a resource so this causes a fatal error. |