From:             Progman2002 at gmx dot de
Operating system: 
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  preg_match can return an array, not only an int

Description:
------------
Its only a typo:

preg_match is defined as:

int preg_match ( string pattern, string subject [, array matches [, int
flags [, int offset]]])

so, it will return an integer.. which is wrong:

| flags can be the following flag: 
|
| PREG_OFFSET_CAPTURE
|
| If this flag is passed, for every occurring match the 
| appendant string offset will also be returned. Note that 
| this changes the return value in an array where every
| element is an array consisting of the matched string at
| offset 0 and its string offset into subject at offset 1.
| This flag is available since PHP 4.3.0 .

So it can also return an Array.

|  preg_match() returns FALSE if an error occurred.

And it can return FALSE. So the "int" of the return-value must be changed
to "mixed"


-- 
Edit bug report at http://bugs.php.net/?id=28408&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28408&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28408&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28408&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28408&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28408&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28408&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28408&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28408&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28408&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28408&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28408&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28408&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28408&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28408&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28408&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28408&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28408&r=float

Reply via email to