#51010 [NEW]: Bad example

From: Date: Thu, 11 Feb 2010 08:31:35 +0000
Subject: #51010 [NEW]: Bad example
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3864@lists.php.net to get a copy of this message
From: chris dot dickinson at web dot de Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Bad example Description: ------------ Hi, On your page http://ch2.php.net/manual/en/function.trigger-error.php you give only this example <?php if (assert($divisor == 0)) { trigger_error("Cannot divide by zero", E_USER_ERROR); } ?> It seems badly chosen. If $divisor is 0 then the assertion succeeds, when actually you would probably not want $divisor to be 0 (!). If $divisor is anything else but 0, the assertion will fail and give you an error message. I got: "Warning: assert() [function.assert]: Assertion failed in ..." Reproduce code: --------------- --- From manual page: function.trigger-error#Examples --- -- Edit bug report at http://bugs.php.net/?id=51010&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51010&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51010&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51010&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51010&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51010&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51010&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51010&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51010&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51010&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51010&r=support Expected behavior: http://bugs.php.net/fix.php?id=51010&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51010&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51010&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51010&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51010&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51010&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51010&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51010&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51010&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51010&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51010&r=mysqlcfg

« previous php.doc.bugs (#3864) next »