Doc #53056 [NEW]: Incomplete information for return value of preg_match
| From: | daniel at parthenonsoftware dot com | Date: | Wed, 13 Oct 2010 22:05:46 +0000 |
| Subject: | Doc #53056 [NEW]: Incomplete information for return value of preg_match | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-5207@lists.php.net to get a copy of this message | ||
From:
Operating system: All
PHP version: 5.3.3
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Incomplete information for return value of preg_match
Description:
------------
While the documentation accurately tells the programmer that preg_match
returns an int, the documentation does not reflect the meaning of the
return value.
As an example, in shell scripting, 0 represents true, where another number
typically represents an error code. Returning 0 from a main application
means everything went successfully.
Further, in some languages like C/C++, 0 is the default return value,
basically meaning "Everything fine nothing to see here move along please".
;-)
The confusion comes from the fact that the preg_match() function returns 1
if a match is found and 0 otherwise.
By adding this sentence to the documentation for preg_match:
The preg_match() function returns 1 if a match is found and 0
otherwise.
A fair bit of confusion would be cleared up by defining the non-standard
meaning up front.
Actual result:
--------------
tt
--
Edit bug report at http://bugs.php.net/bug.php?id=53056&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53056&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53056&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53056&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53056&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53056&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53056&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53056&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53056&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53056&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53056&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53056&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53056&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53056&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53056&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53056&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53056&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53056&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53056&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53056&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53056&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53056&r=mysqlcfg