1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-28 17:52:16 +01:00

PCRE: add missing "Errors/Exceptions" section

All PCRE pattern matching functions will throw a warning when an invalid regex is passed to the `$pattern` parameter.
See: https://3v4l.org/WkVIW

This was thus far undocumented behaviour.

This PR adds:
* The "Errors/Exceptions" section to each of the PCRE pattern matching function documentation pages (if it didn't exist yet).
* Adds a macro for the text snippet about the warning to display in the section and uses that in the "Errors/Exceptions" section for each function.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>

Closes GH-1057.
This commit is contained in:
Juliette
2021-11-08 13:01:56 +01:00
committed by GitHub
parent 0ff45f21e8
commit 41c8533ff5
9 changed files with 41 additions and 0 deletions

View File

@@ -1863,6 +1863,11 @@ data must be properly formatted and all strings must be escaped using
the <function>mysqli_real_escape_string</function>
function.</para></warning>'>
<!-- Notes for PCRE -->
<!ENTITY pcre.pattern.warning '<para xmlns="http://docbook.org/ns/docbook">
If the regex pattern passed does not compile to a valid regex, an <constant>E_WARNING</constant> is emitted.
</para>'>
<!-- Notes for SAPI/Apache -->
<!ENTITY apache.req.module '<simpara xmlns="http://docbook.org/ns/docbook">This function is supported when PHP
is installed as an Apache module webserver.

View File

@@ -37,6 +37,11 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&pcre.pattern.warning;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View File

@@ -63,6 +63,11 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&pcre.pattern.warning;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View File

@@ -284,6 +284,11 @@ Array
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&pcre.pattern.warning;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>

View File

@@ -253,6 +253,11 @@ Array
&return.falseproblem;
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&pcre.pattern.warning;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>

View File

@@ -91,6 +91,11 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&pcre.pattern.warning;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>

View File

@@ -148,6 +148,11 @@ fclose($fp);
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&pcre.pattern.warning;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>

View File

@@ -148,6 +148,7 @@
Using the "\e" modifier is an error;
an <constant>E_WARNING</constant> is emitted in this case.
</para>
&pcre.pattern.warning;
</refsect1>
<refsect1 role="examples">

View File

@@ -103,6 +103,11 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&pcre.pattern.warning;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>