![]() |
Trying to use error_get_last - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: Trying to use error_get_last (/showthread.php?tid=62456) |
Trying to use error_get_last - jLinux - 07-16-2015 In a portion of my script, I try to validate a regex pattern provided by a user, not testing it against a string, but just executing it arbitrarily, then checking for PHP errors. I tested it in a stand alone script and it works perfectly fine, however when I throw the code into a CI library method, it doesnt work at all. I googled it and I found some people saying they had error_get_last() working fine in CI, until they upgraded to a recent version. Is error_get_last disabled for some reason? is there another way to accomplish the exact same thing? Heres the stand alone script I was talking about: PHP Code: <?php Again, that works perfectly fine, until thrown into CI Thanks! RE: Trying to use error_get_last - mwhitney - 07-17-2015 As mentioned in the manual notes for error_get_last(), there are many reasons that it may not work, including the error handler set by CodeIgniter returning a non-FALSE value. Since I haven't tested this, I don't know if that's a strict check; CI has a void return from the error handler if the severity of the error doesn't meet the error reporting level. CI 2 returned from the error handler under slightly different circumstances, and the error reporting levels changed slightly between versions, too. The manual notes contain a number of potential work-arounds, too. In this case, though, I wonder if preg_last_error() has the same issues, or if it just wouldn't work for your situation. RE: Trying to use error_get_last - jLinux - 07-23-2015 (07-17-2015, 07:42 AM)mwhitney Wrote: As mentioned in the manual notes for error_get_last(), there are many reasons that it may not work, including the error handler set by CodeIgniter returning a non-FALSE value. Since I haven't tested this, I don't know if that's a strict check; CI has a void return from the error handler if the severity of the error doesn't meet the error reporting level. CI 2 returned from the error handler under slightly different circumstances, and the error reporting levels changed slightly between versions, too. Good idea, I just gave it a shot tho.. Code: PHP Code: $pattern = '/asdf/df/asdf/adsf'; Output: Quote:PHP Warning: preg_match(): Unknown modifier 'd' in /Users/jhyland/PhpstormProjects/SASSET-App/htdocs/preg.php on line 14 Odd, thats not even via CI ![]() |