From: nairbv at yahoo dot com Operating system: PHP version: 5.2.9 PHP Bug Type: Feature/Change Request Bug description: Error messages often don't make sense.
Description: ------------ Error messages often don't make sense. for example: Catchable fatal error: Argument 1 passed to my_function() must be an instance of string, string given I'd comment on this bug: http://bugs.php.net/bug.php?id=42118 But this reporting system doesn't permit commenting on existing bugs. The bug is NOT bogus. The error message IS non-sense. It's fine if you're not going to support primitive type hinting, but the message should say something to that effect. Also the error is NOT "catchable." See bug: http://bugs.php.net/bug.php?id=41948 Again, I'd comment on that bug, but I can't comment on existing bugs. If the error can only be handled by setting an error handler, and not caught with a "catch" block, the error message should say "RECOVERABLE error" or "handleable" or something to that effect, not "catchable error." Other bad error messages include: "Can't use method return value in write context" see bug: http://bugs.php.net/bug.php?id=44565 "write context" is meaningless to the programmer. On that bug, the reporter commented that the message is not helpful. Why was the bug closed instead of fixing the error message?? Reproduce code: --------------- for the first error message: function my_function(string $str) {} bar(''); for the second error message: empty($foo->getValue()); or also the code in bug #44565. Expected result: ---------------- error messages that help the programmer. for the "catchable" error regarding type hinting: Either something like: "Recoverable fatal error: reference to undefined class 'string' on line [line of type hint]" or: "Recoverable fatal error: Argument 1 passed to my_function() must be an instance of class string, primitive string given." For the empty($foo->getbar());"write context" message: It should probably say something like "cannot use method return value when calling internal language constructs" ... or something like that. For the "write context" message referenced in bug 44565: it should give the '"call-time pass-by-reference" is deprecated when you use & in foo(&$a);' like the documentation (http://docs.php.net/manual/en/language.references.pass.php) says it will. Actual result: -------------- Useless (and sometimes amusing) error messages like "must be an instance of string, string given" or the "write context" message which as far as I know is in reference to some implementation detail internal to php. -- Edit bug report at http://bugs.php.net/?id=47783&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47783&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47783&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47783&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47783&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47783&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47783&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47783&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47783&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47783&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47783&r=support Expected behavior: http://bugs.php.net/fix.php?id=47783&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47783&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47783&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47783&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47783&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47783&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47783&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47783&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47783&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47783&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47783&r=mysqlcfg