show_error bug? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: show_error bug? (/showthread.php?tid=40507) |
show_error bug? - El Forum - 04-11-2011 [eluser]JayKae[/eluser] So I have been trying to extend the default CI_Exceptions class. But what is driving me crazy is that it isn't working properly. I'm using CI 2.0.2 excerpt below is from system/core/Exceptions.php Code: /** Adding some debug logic was my only change to the function. I thought it might be something I was doing wrong, so I renamed MY_Exceptions.php to something else so it is not coming into play. Simply calling Code: show_error('$heading', '$message', '$template', 404); Quote: Heading: $template I found the reason that it isn't working. In system/core/Common.php the following method is declared. Code: /** The function signatures aren't the same and that is what is causing the issue. I am assuming this is an oversight and I should file a bug report but I want to make sure that I haven't overlooked anything, I'm only 4 days into learning CI. show_error bug? - El Forum - 04-11-2011 [eluser]InsiteFX[/eluser] An Error Was Encountered Status codes must be numeric Try this: Code: function show_error($heading, $message, $template = 'error_general', (int)$status_code = 500) InsiteFX show_error bug? - El Forum - 04-11-2011 [eluser]JayKae[/eluser] The actual issue is that show_error in CI_Exception signature is: Code: show_error($heading, $message, $template = 'error_general', $status_code = 500) Code: show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') The signatures are off but show_error in common calls the show_error in exception, so I have no way of access the actual CI_Exception arguments show_error bug? - El Forum - 04-11-2011 [eluser]InsiteFX[/eluser] Oh, I see what you mean now, you should file a BUG report on the Reactor Bitbucket. InsiteFX show_error bug? - El Forum - 05-11-2011 [eluser]Unknown[/eluser] I found issues trying to get this to work as well. I used this example to start: http://www.outofrepose.com/2010/02/17/extending-codeigniters-exceptions-class/ Two things: 1. JayKae is right, the two signatures are different which adds to confusion for someone not well versed in CI but its manageable. 2. MY_Exceptions.php should be in core and not libraries. (or whatever you prefix your custom class files with). |