php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37801 PHP doesn't see the ID of input elements
Submitted: 2006-06-14 11:42 UTC Modified: 2006-06-22 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: wilco at pangeadc dot nl Assigned:
Status: No Feedback Package: DOM XML related
PHP Version: 5.1.4 OS: windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wilco at pangeadc dot nl
New email:
PHP Version: OS:

 

 [2006-06-14 11:42 UTC] wilco at pangeadc dot nl
Description:
------------
It seems to me PHP is unable to find the ID of input elements using the loadHTML function.

I've tried many combinations and I can locate any element with this script accept the input. The problem also occures on domdoccument::getElementById.

Reproduce code:
---------------
<?PHP
$htmlcode = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html><head><title>Foo my bar</title></head>
<body><input id=\"my_input\" /><textarea cols=\"3\" rows=\"2\" id=\"my_textarea\" /></body>
</html>";

$html = new DOMDocument();
$html->loadHTML($htmlcode);
$html->validate();
$input = $html->getElementsByTagName('input')->item(0);
echo "input: ";
var_dump($input->getAttributeNode('id')->isId());

$textarea = $html->getElementsByTagName('textarea')->item(0);
echo "textarea: ";
var_dump($textarea->getAttributeNode('id')->isId());

?>

Expected result:
----------------
input: bool(true)
textarea: bool(true)

Actual result:
--------------
input: bool(false)
textarea: bool(true)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-14 12:31 UTC] bjori@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip
 [2006-06-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-01-19 20:39 UTC] bozle at bluewin dot ch
I have got the same problem. PHP Version 5.2.8; Debian Etch.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 11:01:28 2025 UTC