php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74992 wrong behaviour for attribute "selected"
Submitted: 2017-07-26 09:49 UTC Modified: 2017-07-26 12:25 UTC
From: yuriy at vihv dot org Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 7.0.21 OS: Linux Fedora 24.x86_64
Private report: No CVE-ID: None
 [2017-07-26 09:49 UTC] yuriy at vihv dot org
Description:
------------
during transformation to XML attribute "selected" always set to empty string.
That might be ok for trasformation to HTML, but for XML it's wrong.

If I rename attribute - all works as expected.
Also on earlier version selected works just fine.

 

Test script:
---------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="no"/>
    <xsl:template name="selectTemplate">
        <select>
           <option value="123" selected="selected">value</option>
        </select>
    </xsl:template>
</xsl:stylesheet>

Expected result:
----------------
Correct XHTML will be

<select>
    <option value="123" selected="selected">value</option>
</select>

or at least it should be correct HTML5

<select>
    <option value="123" selected>value</option>
</select>

Actual result:
--------------
<select>
   <option value="123" selected="">value</option>
</select>

Firefox treat this element as NOT selected

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-26 10:03 UTC] yuriy at vihv dot org
Oopps, sorry, that's firefox problem. Firebug showed 'selected=""' but source codes as text are correct, just "selected".

Sorry for bothering you.
 [2017-07-26 12:25 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-07-26 12:25 UTC] requinix@php.net
as commented
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 18:01:24 2019 UTC