Last modified: 2010-05-15 14:35:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 499 - Numeric entity references in alt text
Numeric entity references in alt text
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: parser
Depends on:
Blocks: 367
  Show dependency treegraph
 
Reported: 2004-09-15 17:46 UTC by Alan Barrett
Modified: 2010-05-15 14:35 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Alan Barrett 2004-09-15 17:46:26 UTC
Wikitext like [[Image:Whatever.gif|♀]] generates HTML output like 
<img src="..." alt="&amp;#9792;">, whereas it should generate HTML 
output like <img src="..." alt="&#9792;">.
Comment 1 Wil Mahan 2004-10-04 18:56:44 UTC
The culprit is this line in Skin::makeImageLinkObj():

 $alt = htmlspecialchars( $alt );

I think a good fix would be to instead just replace
" with &quot;. I won't commit this change yet, to avoid
interfering with other work on alt tags (like bug 368).
Comment 2 Rowan Collins [IMSoP] 2004-10-04 19:01:42 UTC
Don't forget < and > as well; I suspect leaving those unescaped in attributes is
rather a bad idea. And what about literally & - that *does* need to be escaped
to &amp; Somehow, we need to say "escape things that aren't escaped entities
already" :/
Comment 3 Wil Mahan 2004-10-04 23:13:02 UTC
(In reply to comment #2)
> Don't forget < and > as well; I suspect leaving those unescaped in attributes is
> rather a bad idea. And what about literally & - that *does* need to be escaped
> to &amp; Somehow, we need to say "escape things that aren't escaped entities
> already" :/

Right you are. How about this (the regexp is taken from Parser):

$alt = preg_replace('/&(?!:amp;|#[Xx][0-9A-fa-f]+;|#[0-9]+;|[a-zA-Z0-9]+;)/',
   '&amp;', $alt);
$alt = str_replace( array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $alt );

Btw, makeThumbLinkObj() has the same code, and so should be changed as well.
Skin.php has a lot of duplicate code, it seems.
Comment 4 Wil Mahan 2004-10-05 04:14:59 UTC
I committed the change to HEAD (Skin.php revision 1.287), and
added a parser test case for this bug.
Comment 5 Brion Vibber 2004-12-11 23:26:59 UTC
1.4 release imminent, resolving as fixed.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links