Doc #78163 [Opn->Ver]: preg_quote() documented as accepting null for $delimiter, which actually throws
| From: | cmb@php.net | Date: | Fri, 14 Jun 2019 16:07:59 +0000 |
| Subject: | Doc #78163 [Opn->Ver]: preg_quote() documented as accepting null for $delimiter, which actually throws | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16748@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78163&edit=1
ID: 78163
Updated by: cmb@php.net
Reported by: sp at fp dot de
Summary: preg_quote() documented as accepting null for
$delimiter, which actually throws
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: PCRE related
PHP Version: 7.3.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2019-06-14 15:33:43] requinix@php.net
Per the source, the actual default value is "\0" (which is always quoted anyways).
------------------------------------------------------------------------
[2019-06-14 15:29:53] sp at fp dot de
Description:
------------
Referring to Nikitas post:
https://www.mail-archive.com/internals@lists.php.net/msg98043.html
> If you see something that is documented as =null, but does not behave the
> same when null is passed, please do report a bug.
preg_quote() seems to fall under that category:
https://www.php.net/manual/en/function.preg-quote.php
It is documented as:
preg_quote ( string $str [, string $delimiter = NULL ] ) : string
But actually passing NULL as second argument throws TypeError with strict_types=1:
"Fatal error: Uncaught TypeError: preg_quote() expects parameter 2 to be string, null
given"
Test script:
---------------
https://3v4l.org/ufjFF
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78163&edit=1