Doc #73709 [Ver->Csd]: preg_match_all PREG_OFFSET_CAPTURE documentation incorrect

From: Date: Sat, 10 Dec 2016 16:29:31 +0000
Subject: Doc #73709 [Ver->Csd]: preg_match_all PREG_OFFSET_CAPTURE documentation incorrect
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14208@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73709&edit=1 ID: 73709 Updated by: cmb@php.net Reported by: chris at ocproducts dot com Summary: preg_match_all PREG_OFFSET_CAPTURE documentation incorrect -Status: Verified +Status: Closed Type: Documentation Problem Package: PCRE related PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2016-12-10 16:29:16] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&revision=341360 Log: Fix #73709: preg_match_all PREG_OFFSET_CAPTURE documentation incorrect ------------------------------------------------------------------------ [2016-12-10 14:02:18] chris at ocproducts dot com 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 this bug report at https://bugs.php.net/bug.php?id=73709&edit=1

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