Doc #73709 [NEW]: preg_match_all PREG_OFFSET_CAPTURE documentation incorrect

From: Date: Sat, 10 Dec 2016 14:02:20 +0000
Subject: Doc #73709 [NEW]: preg_match_all PREG_OFFSET_CAPTURE documentation incorrect
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14206@lists.php.net to get a copy of this message
From: chris at ocproducts dot com Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:preg_match_all PREG_OFFSET_CAPTURE documentation incorrect Description: ------------ The documentation against PREG_OFFSET_CAPTURE for the preg_match_all function is an exact copy & paste from the preg_match function. However, preg_match_all has 3 levels of array, while preg_match has 2 levels. This is what the documentation says in both cases: "If this flag is passed, for every occurring match the appendant string offset will also be returned. Note that this changes the value of matches into 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." Observe how it explicitly details the (and only the) 2 levels of returned array, while actually it has 3 levels. I actually got very confused about PREG_OFFSET_CAPTURE and preg_match_all behaviour over the years and now I see why. -- Edit bug report at https://bugs.php.net/bug.php?id=73709&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73709&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73709&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73709&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73709&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73709&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73709&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73709&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73709&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73709&r=support Expected behavior: https://bugs.php.net/fix.php?id=73709&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73709&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73709&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73709&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73709&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73709&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73709&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73709&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73709&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73709&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73709&r=mysqlcfg

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