php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38117 php 5.1.2 dom object preserveWhiteSpace
Submitted: 2006-07-16 22:43 UTC Modified: 2006-07-18 11:27 UTC
From: protano at wp dot pl Assigned:
Status: Not a bug 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: protano at wp dot pl
New email:
PHP Version: OS:

 

 [2006-07-16 22:43 UTC] protano at wp dot pl
Description:
------------
In  windows version 5.1.2 php dom->preserveWhiteSpace = false;   does not act correctly.
So as this option would not be put.

In PHP Version 5.0.5-Debian-0.8~sarge1 it works correctly.



Reproduce code:
---------------
	$doc = new DOMDocument;
	$doc->preserveWhiteSpace = false;
	$doc->loadHTML($buffer);
	$xpath = new DOMXPath($doc);
	
	$query = '//html/body/td/b';
	$entries = $xpath->query($query);
	$data=$entries->item(1)->nodeValue;


Expected result:
----------------
whitespaces between tags(xml elements) should be ignored.


Actual result:
--------------
whitespaces between tags(xml elements) are't ignore.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-17 06:34 UTC] tony2001@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-07-17 07:07 UTC] chregu@php.net
Are you using the same libxml2 versions on both systems? Maybe 
that's the reason...
 [2006-07-18 07:45 UTC] protano at wp dot pl
// ***  WINDOWS with error  ***/ 

DOM/XML 	enabled 	
DOM/XML API Version 	20031129 	
libxml Version 	2.6.22 	
HTML Support 	enabled 	
XPath Support 	enabled 	
XPointer Support 	enabled 	
Schema Support 	enabled 	
RelaxNG Support 	enabled
// *************************** //


// *** LINUX works fine *** //
DOM/XML 	enabled 	
DOM/XML API Version 	20031129 	
libxml Version 	2.6.16 	
HTML Support 	enabled 	
XPath Support 	enabled 	
XPointer Support 	enabled 	
Schema Support 	enabled 	
RelaxNG Support 	enabled
// **************************** //
 [2006-07-18 11:27 UTC] rrichards@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

preserveWhiteSpace has no effect using loadHTML() - only XML load methods - so behavior is due to different libxml2 versions (looks like behavior was fixed with newer version)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 17:01:33 2025 UTC