Page MenuHomePhabricator

Image alt value '0' should not be removed
Closed, ResolvedPublic

Description

Two cases:

[[File:example.svg|20px|1]]
[[File:example.svg|20px|0]]

The first has an alt value of '1' when rendered, the seconds a value of ''.

This is likely due to the use of php's empty() http://php.net/manual/en/function.empty.php which treats '0' as an empty value.

Our use of empty() is in includes/media/MediaTransformOutput.php: $alt = empty( $options['alt'] ) ? '' : $options['alt'];


Version: 1.20.x
Severity: minor

Details

Reference
bz38910

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:48 AM
bzimport set Reference to bz38910.
bzimport added a subscriber: Unknown Object (MLST).

koosha.khajeh wrote:

patch - v1

attachment patch ignored as obsolete

sumanah wrote:

Thanks for the patch! It would be easier to review it if you put it directly in our source control system: https://www.mediawiki.org/wiki/Git/Tutorial

sumanah wrote:

Comment on attachment 11035
patch - v1

This patch has been superseded by the patchset in Gerrit.

Change 116483 had a related patch set uploaded by Aaron Schulz:
Resetting img alt value as "0"

https://gerrit.wikimedia.org/r/116483

Change 116483 had a related patch set uploaded by Krinkle:
Resetting img alt value as '0'

https://gerrit.wikimedia.org/r/116483

Change 116483 merged by jenkins-bot:
MediaTransformOutput: Allow <img> alt value to be "0"

https://gerrit.wikimedia.org/r/116483