[doc-en] master: tidy: fix outdated example outputs and the tidy_diagnose() note (#6156)

From: Date: Fri, 27 Nov 2026 12:48:29 +0000
Subject: [doc-en] master: tidy: fix outdated example outputs and the tidy_diagnose() note (#6156)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-24029@lists.php.net to get a copy of this message
Author: Louis-Arnaud (lacatoire) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-11-27T13:48:25+01:00 Commit: https://github.com/php/doc-en/commit/2dd432924c34dbbd18f77e57d2ae99b4e3171882 Raw diff: https://github.com/php/doc-en/commit/2dd432924c34dbbd18f77e57d2ae99b4e3171882.diff tidy: fix outdated example outputs and the tidy_diagnose() note (#6156) Changed paths: M reference/tidy/functions/tidy-access-count.xml M reference/tidy/functions/tidy-config-count.xml M reference/tidy/functions/tidy-error-count.xml M reference/tidy/functions/tidy-get-output.xml M reference/tidy/functions/tidy-warning-count.xml Diff: diff --git a/reference/tidy/functions/tidy-access-count.xml b/reference/tidy/functions/tidy-access-count.xml index 186f8840345f..08465b6df842 100644 --- a/reference/tidy/functions/tidy-access-count.xml +++ b/reference/tidy/functions/tidy-access-count.xml @@ -62,10 +62,7 @@ $tidy = new tidy(); $tidy->parseString($html, $config); $tidy->cleanRepair(); -/* Never forget to call this! */ -$tidy->diagnose(); - -echo tidy_access_count($tidy); //5 +echo tidy_access_count($tidy); //6 ?> ]]> @@ -76,13 +73,12 @@ echo tidy_access_count($tidy); //5 <refsect1 role="notes"> &reftitle.notes; <note> - <para> - Due to the design of the TidyLib, you must call - <function>tidy_diagnose</function> before - <function>tidy_access_count</function> or it will return always - <literal>0</literal>. You must also need to enable the - <literal>accessibility-check</literal> option. - </para> + <simpara> + The <literal>accessibility-check</literal> option must be enabled when + the document is parsed, or <function>tidy_access_count</function> will + always return <literal>0</literal>. Calling + <function>tidy_diagnose</function> is not required. + </simpara> </note> </refsect1> <refsect1 role="seealso"> diff --git a/reference/tidy/functions/tidy-config-count.xml b/reference/tidy/functions/tidy-config-count.xml index 25262392d008..34c33ba46de6 100644 --- a/reference/tidy/functions/tidy-config-count.xml +++ b/reference/tidy/functions/tidy-config-count.xml @@ -50,18 +50,40 @@ <?php $html = '<p>test</I>'; -$config = array('doctype' => 'bogus'); +// Invalid values in a configuration array throw a TypeError as of PHP 8.5.0, +// so the invalid value is read from a configuration file +$configFile = tempnam(sys_get_temp_dir(), 'tidy'); +file_put_contents($configFile, "wrap: abc\n"); -$tidy = tidy_parse_string($html, $config); +$tidy = tidy_parse_string($html, $configFile); -/* This outputs 1, because 'bogus' isn't a valid doctype */ +/* This outputs 1, because 'abc' isn't a valid wrap value */ echo tidy_config_count($tidy); + +unlink($configFile); ?> ]]> </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Notice: tidy_parse_string(): There were errors while parsing the Tidy configuration file "/tmp/tidyAbC123" in %s on line %d +1 +]]> + </screen> </example> </para> </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><function>tidy_get_config</function></member> + <member><function>tidy_getopt</function></member> + <member><function>tidy_error_count</function></member> + <member><function>tidy_warning_count</function></member> + </simplelist> + </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: diff --git a/reference/tidy/functions/tidy-error-count.xml b/reference/tidy/functions/tidy-error-count.xml index d8a74abd0aa3..90b7cc9eac50 100644 --- a/reference/tidy/functions/tidy-error-count.xml +++ b/reference/tidy/functions/tidy-error-count.xml @@ -63,6 +63,7 @@ echo $tidy->errorBuffer; <![CDATA[ 1 line 1 column 1 - Warning: missing <!DOCTYPE> declaration +line 1 column 1 - Warning: inserting implicit <body> line 1 column 8 - Warning: discarding unexpected </i> line 2 column 1 - Error: <bogustag> is not recognized! line 2 column 1 - Warning: discarding unexpected <bogustag> @@ -79,6 +80,7 @@ line 1 column 1 - Warning: inserting missing 'title' element <simplelist> <member><function>tidy_access_count</function></member> <member><function>tidy_warning_count</function></member> + <member><function>tidy_config_count</function></member> </simplelist> </refsect1> </refentry> diff --git a/reference/tidy/functions/tidy-get-output.xml b/reference/tidy/functions/tidy-get-output.xml index 0b496d30c40b..25d4066116c0 100644 --- a/reference/tidy/functions/tidy-get-output.xml +++ b/reference/tidy/functions/tidy-get-output.xml @@ -57,7 +57,7 @@ echo tidy_get_output($tidy); &example.outputs; <screen> <![CDATA[ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<!DOCTYPE html> <html> <head> <title></title> @@ -71,6 +71,15 @@ echo tidy_get_output($tidy); </example> </para> </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><function>tidy_parse_string</function></member> + <member><function>tidy_clean_repair</function></member> + <member><function>tidy_repair_string</function></member> + </simplelist> + </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: diff --git a/reference/tidy/functions/tidy-warning-count.xml b/reference/tidy/functions/tidy-warning-count.xml index b11d975eb7dc..4dc430a17ae3 100644 --- a/reference/tidy/functions/tidy-warning-count.xml +++ b/reference/tidy/functions/tidy-warning-count.xml @@ -50,7 +50,7 @@ $html = '<p>test</i> $tidy = tidy_parse_string($html); echo tidy_error_count($tidy) . "\n"; //1 -echo tidy_warning_count($tidy) . "\n"; //5 +echo tidy_warning_count($tidy) . "\n"; //6 ?> ]]> </programlisting> @@ -63,6 +63,7 @@ echo tidy_warning_count($tidy) . "\n"; //5 <simplelist> <member><function>tidy_error_count</function></member> <member><function>tidy_access_count</function></member> + <member><function>tidy_config_count</function></member> </simplelist> </para> </refsect1>

« previous php.doc.cvs (#24029) next »