Bug #54138 [Nab->ReO]: DOMNode::getLineNo() doesn't return line number higher than 65535

From: Date: Wed, 03 Jun 2015 12:56:31 +0000
Subject: Bug #54138 [Nab->ReO]: DOMNode::getLineNo() doesn't return line number higher than 65535
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193088@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54138&edit=1 ID: 54138 Updated by: cmb@php.net Reported by: dmitrij at stepanov dot lv Summary: DOMNode::getLineNo() doesn't return line number higher than 65535 -Status: Not a bug +Status: Re-Opened Type: Bug Package: XML Reader Operating System: Windows 7 PHP Version: 5.3.5 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Re-opened according to Ruud's comment. Not sure, whether that should be categorized as feature request, though. Previous Comments: ------------------------------------------------------------------------ [2013-10-25 21:09:24] ruud at vanmelick dot com This is solved in libxml2 version 2.9+. However, you have to explicitly tell libxml to support it, which you can do in PHP by using using the options parameter in functions like DOMDocument::load (option 2^22 = 4194304 = XML_PARSE_BIG_LINES). Currently there's no PHP libxml constant for that purpose. ------------------------------------------------------------------------ [2012-06-19 12:42:25] hanskrentel at yahoo dot de The function DOMNode::getLineNo() is not able to return a line number higher than 65535. Test Script: <?php $xml = "<?xml version=\"1.0\"?><root>".str_repeat("\n", 65537) ."<mix>end</mix>\n<mix>end</mix></root>" ; echo dom_import_simplexml( end(simplexml_load_string($xml)->xpath('//text()')) )->getLineNo() ; ?> Expected result: 65537 Actual result: 65535 Summary: Reported back in 2007, upstream does not know how to fix this w/o breaking stuff (binary compatibility). It's also worth to mention that normally files with more than 65k lines aren't written by hand so don't require that type of functionality. Naturally this is subjective. To fix this this requires a different upstream/patch of one of the underlying libraries, e.g. libxml2. The debian ticket has a patch. https://mail.gnome.org/archives/xml/2007-October/msg00002.html http://lxr.php.net/xref/PHP_5_3/ext/dom/node.c#1955 http://lxr.php.net/xref/PHP_5_3/ext/libxml/php_libxml2.def#419 http://xmlsoft.org/html/libxml-tree.html#xmlGetLineNo https://bugzilla.gnome.org/show_bug.cgi?id=676026 http://stackoverflow.com/a/11099693/367456 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=445961 ------------------------------------------------------------------------ [2011-03-02 16:17:33] rrichards@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Known limitation of libxml2 ------------------------------------------------------------------------ [2011-03-02 15:23:44] dmitrij at stepanov dot lv Description: ------------ DOMNode::getLineNo() doesn't return line number higher than 65535. I assume that unsigned short is used for file line enumeration either in XMLReader or DOMNode internals. Test script: --------------- Try reading with XMLReader an XML file that has more than 65535 lines. Then, when line nr. > 65535 is reached, call XMLReader::expand()->getLineNo(). Expected result: ---------------- Correct line number. Actual result: -------------- 65535 for lines, higher than 65525. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54138&edit=1

« previous php.bugs (#193088) next »