#41128 [Bgs]: Trigger error fails if more than two parameters

From: Date: Wed, 18 Apr 2007 10:28:09 +0000
Subject: #41128 [Bgs]: Trigger error fails if more than two parameters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111641@lists.php.net to get a copy of this message
ID: 41128 User updated by: catzwolf at zarilia dot com Reported By: catzwolf at zarilia dot com Status: Bogus Bug Type: Unknown/Other Function Operating System: windows PHP Version: 5.2.1 New Comment: That is my whole point,it was a mistake on my part and it took me half an hour trying to find out why my errorhandler was not working correctly. When I removed the 3rd parameter from the function it worked as it should. Adding that third value totally rendered this function unworkable. Did you even test this? Did you even go and see how this error affects the workablity of this function? Anyway thanks for your time. Previous Comments: ------------------------------------------------------------------------ [2007-04-18 10:06:58] tony2001@php.net >If a function only excepts 2 paramenters and works as expected >and you add a 3rd (that shouldn't be there) then I would expect >that function to ignore the 3rd parameter and still function as intended. Your expectations are wrong, none of internal funcs work this way. They have certain number of required and accepted parameters and passing more arguments than can accepted is clearly your mistake. ------------------------------------------------------------------------ [2007-04-18 09:55:44] catzwolf at zarilia dot com Ok I fail to see the logic as why this would not be considered a bug? If a function only excepts 2 paramenters and works as expected and you add a 3rd (that shouldn't be there) then I would expect that function to ignore the 3rd parameter and still function as intended. So what you are saying is this? function security($foo, $bar) { return ($foo && $bar ) ? true :false; } security(1,1); This function would return true, but if we did this? security(1,1,1); It would return false? Even though there is no 3rd parameter in the function. Sorry but that isn't logical at all and any script that requires this to work correctly would fail all because of a 3rd value that shouldn't be there? Because that is what is happening with trigger_error. ------------------------------------------------------------------------ [2007-04-18 09:34:36] tony2001@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php http://php.net/trigger_error ------------------------------------------------------------------------ [2007-04-18 09:27:05] catzwolf at zarilia dot com Description: ------------ It seems in php 5.2.1 that there is a bug that will render your 'user errorhander' useless if you add more than 2 Parameters for the arguement. Doing something like this will cause the trap to fail and not trapped. I don't think that this sort of behaviour would be by design, so a bug? Reproduce code: --------------- trigger_error( "oops we have a fatal error", E_USER_ERROR, __LINE_ ); Expected result: ---------------- I would expect the user errorhandler to trap the error and display it Actual result: -------------- It is ignored by the user error handler and php internal error handling displays the error instead. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41128&edit=1

« previous php.bugs (#111641) next »