Edit report at https://pear.php.net/bugs/bug.php?id=14380&edit=1
ID: 14380
Updated by: daniel.oconnor@gmail.com
Reported By: detritus at blueyonder dot co dot uk
Summary: Image Filter does not generate alt by default
-Status: Verified
+Status: Closed
Type: Bug
Package: HTML_BBCodeParser
Package Version: 1.2.2
PHP Version: Irrelevant
-Assigned To:
+Assigned To: doconnor
Roadmap Versions:
New Comment:
-Status: Verified
+Status: Closed
-Assigned To:
+Assigned To: doconnor
This bug has been fixed in SVN.
If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).
If this was a problem with the pear.php.net website, the change should
be live shortly.
Otherwise, the fix will appear in the package's next release.
Thank you for the report and for helping us make PEAR better.
Previous Comments:
------------------------------------------------------------------------
[2008-09-15 22:34:02] cagecrawler
A quick and dirty solution is to change line 76:
------
$o."img=\"\$2\"\$1".$c.$o."/img".$c,
------
to the following:
------
$o."img=\"\$2\" alt=\"\"\$1".$c.$o."/img".$c,
------
------------------------------------------------------------------------
[2008-07-26 09:23:39] doconnor
(don't forget the require_once)
<?php
require_once 'HTML/BBCodeParser.php';
$parser = new HTML_BBCodeParser();
$parser->addFilter('Images');
echo $parser->qparse('[img]example.png[/img]');
echo $parser->qparse('[img alt=Example image]example.png[/img]');
------------------------------------------------------------------------
[2008-07-21 13:19:01] detritus
Description:
------------
The Image Filter ([img][/img]) does not currently create a default
alternative text (alt="") resulting in common usage of image BB code
being non-standard compliant XHTML 1.0.
Test script:
---------------
<?php
$parser = new HTML_BBCodeParser();
$parser->addFilter('Images');
echo $parser->qparse('[img]example.png[/img]');
echo $parser->qparse('[img alt=Example image]example.png[/img]');
?>
Expected result:
----------------
<img src="example.png" alt="" />
<img src="example.png" alt="Example Image" />
Actual result:
--------------
<img src="example.png" />
<img src="example.png" alt="Example Image" />
------------------------------------------------------------------------