|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: yuriy at vihv dot org
New email:
PHP Version: OS:


 [2017-07-26 09:49 UTC] yuriy at vihv dot org
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="">
    <xsl:output method="xml" encoding="utf-8" indent="no"/>
    <xsl:template name="selectTemplate">
           <option value="123" selected="selected">value</option>

Expected result:
Correct XHTML will be

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

or at least it should be correct HTML5

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

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

Firefox treat this element as NOT selected


Add a Patch

Pull Requests

Add a Pull Request


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]
-Status: Open +Status: Not a bug
 [2017-07-26 12:25 UTC]
as commented
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Feb 28 00:01:23 2021 UTC