doc-en icon indicating copy to clipboard operation
doc-en copied to clipboard

Update default value for assert.exception

Open SvenRtbg opened this issue 2 years ago • 4 comments

Based on https://github.com/php/php-src/pull/5925/files

SvenRtbg avatar Oct 11 '22 15:10 SvenRtbg

Thank you for the PR! This page is in dire need of a general overhaul, but this looks like a start. I suggest, though, to completely remove the "PHP 7 configuration directives for assert" table from this page, and instead to refer to https://www.php.net/manual/en/ini.core.php and https://www.php.net/manual/en/info.configuration.php, respectively (no need to duplicate the information).

Suggestion
 reference/info/functions/assert.xml | 62 ++-----------------------------------
 1 file changed, 3 insertions(+), 59 deletions(-)

diff --git a/reference/info/functions/assert.xml b/reference/info/functions/assert.xml
index 5aeba571f3..980da3c53e 100644
--- a/reference/info/functions/assert.xml
+++ b/reference/info/functions/assert.xml
@@ -90,68 +90,12 @@
    <para>
     While <function>assert_options</function> can still be used to control
     behaviour as described above for backward compatibility reasons, PHP 7
-    only code should use the two new configuration directives to control
+    only code should use the two new configuration directives
+    <link linkend="ini.zend.assertions">zend.assertions</link> and
+    <link linkend="ini.assert.exception">assert.exception</link> to control
     the behaviour of <function>assert</function> and not call
     <function>assert_options</function>.
    </para>
-   <table>
-    <title>
-     PHP 7 configuration directives for <function>assert</function>
-    </title>
-    <tgroup cols="3">
-     <thead>
-      <row>
-       <entry>Directive</entry>
-       <entry>Default value</entry>
-       <entry>Possible values</entry>
-      </row>
-     </thead>
-     <tbody>
-      <row>
-       <entry>
-        <link linkend="ini.zend.assertions">zend.assertions</link>
-       </entry>
-       <entry><literal>1</literal></entry>
-       <entry>
-        <simplelist>
-         <member>
-          <literal>1</literal>: generate and execute code (development mode)
-         </member>
-         <member>
-          <!-- TODO: look up the RFC to figure out why you'd want this -->
-          <literal>0</literal>: generate code but jump around it at runtime
-         </member>
-         <member>
-          <literal>-1</literal>: do not generate code (production mode)
-         </member>
-        </simplelist>
-       </entry>
-      </row>
-      <row>
-       <entry>
-        <link linkend="ini.assert.exception">assert.exception</link>
-       </entry>
-       <entry><literal>0</literal></entry>
-       <entry>
-        <simplelist>
-         <member>
-          <literal>1</literal>: throw when the assertion fails, either by
-          throwing the object provided as the <parameter>exception</parameter>
-          or by throwing a new <classname>AssertionError</classname> object if
-          <parameter>exception</parameter> wasn't provided
-         </member>
-         <member>
-          <literal>0</literal>: use or generate a
-          <classname>Throwable</classname> as described above, but only
-          generate a warning based on that object rather than throwing it
-          (compatible with PHP 5 behaviour)
-         </member>
-        </simplelist>
-       </entry>
-      </row>
-     </tbody>
-    </tgroup>
-   </table>
   </refsect2>
  </refsect1>

We may want to improve the description of assert.exception there; note, though, that PHP 5 information is irrelevant for the manual now (only PHP 7 and PHP 8 are supposed to be documented).

cmb69 avatar Oct 14 '22 14:10 cmb69

IMHO, if it is not creating a huge mess attempting to describe what is valid for which version, I would always opt for keeping outdated PHP versions in the documentation. As much as we dislike it, people are still forced to use them, at least they might try to understand what stuff did when trying to upgrade their code.

However your comment highlights that the primary focus probably should be the current version, with maybe additional hints about previous versions if they changed significantly since then. I'll try to rework this PR.

SvenRtbg avatar Oct 15 '22 12:10 SvenRtbg

I would always opt for keeping outdated PHP versions in the documentation.

That ship has sailed long ago when we decided to remove information about versions prior to PHP 7.0.0. The old documentation is still available (even online). It is just that some infos have not been removed yet.

cmb69 avatar Oct 15 '22 12:10 cmb69

I'll restrict myself to these two pages then, to avoid reworking the whole documentation. :) Didn't knew archived PHP5-docs were available.

SvenRtbg avatar Oct 15 '22 12:10 SvenRtbg

Superceded by #2467

Girgias avatar Jul 25 '23 14:07 Girgias