diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2015-06-04 00:59:41 +0200 |
|---|---|---|
| committer | Anatol Belski <ab@php.net> | 2015-06-08 09:59:36 +0200 |
| commit | a1951c2e0a837dedfc3927817c6057b832692e97 (patch) | |
| tree | fa4e8f5160effcfa057f8f9cca09c96187aeedfa | |
| parent | f661b10536c03f5e7235e644967f3ba8eb33c32c (diff) | |
| download | php-git-a1951c2e0a837dedfc3927817c6057b832692e97.tar.gz | |
added tests for bug #54138
| -rw-r--r-- | ext/libxml/tests/bug54138.phpt | 23 | ||||
| -rw-r--r-- | ext/libxml/tests/bug54138_1.phpt | 24 | ||||
| -rw-r--r-- | ext/libxml/tests/bug54138_2.phpt | 25 |
3 files changed, 72 insertions, 0 deletions
diff --git a/ext/libxml/tests/bug54138.phpt b/ext/libxml/tests/bug54138.phpt new file mode 100644 index 0000000000..5a03f2ce07 --- /dev/null +++ b/ext/libxml/tests/bug54138.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #54138 - DOMNode::getLineNo() doesn't return line number higher than 65535 +--SKIPIF-- +<?php +if (!extension_loaded('dom')) die('skip dom extension not available'); +if (!defined('LIBXML_BIGLINES')) die('skip this test requires LIBXML_BIGLINES'); +?> +--FILE-- +<?php +$foos = str_repeat('<foo/>' . PHP_EOL, 65535); +$xml = <<<XML +<?xml version="1.0" encoding="UTF-8"?> +<root> +$foos +<bar/> +</root> +XML; +$dom = new DOMDocument(); +$dom->loadXML($xml, LIBXML_BIGLINES); +var_dump($dom->getElementsByTagName('bar')->item(0)->getLineNo()); +?> +--EXPECT-- +int(65540) diff --git a/ext/libxml/tests/bug54138_1.phpt b/ext/libxml/tests/bug54138_1.phpt new file mode 100644 index 0000000000..f0a8a04698 --- /dev/null +++ b/ext/libxml/tests/bug54138_1.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #54138 - DOMNode::getLineNo() doesn't return line number higher than 65535 +--SKIPIF-- +<?php +if (!extension_loaded('dom')) die('skip dom extension not available'); +if (LIBXML_VERSION >= 20900) die('skip this test is for libxml < 2.9.0 only'); +?> +--FILE-- +<?php +define('LIBXML_BIGLINES', 1<<22); +$foos = str_repeat('<foo/>' . PHP_EOL, 65535); +$xml = <<<XML +<?xml version="1.0" encoding="UTF-8"?> +<root> +$foos +<bar/> +</root> +XML; +$dom = new DOMDocument(); +$dom->loadXML($xml, LIBXML_BIGLINES); +var_dump($dom->getElementsByTagName('bar')->item(0)->getLineNo()); +?> +--EXPECT-- +int(65535) diff --git a/ext/libxml/tests/bug54138_2.phpt b/ext/libxml/tests/bug54138_2.phpt new file mode 100644 index 0000000000..b25e451527 --- /dev/null +++ b/ext/libxml/tests/bug54138_2.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #54138 - DOMNode::getLineNo() doesn't return line number higher than 65535 +--SKIPIF-- +<?php +if (!extension_loaded('dom')) die('skip dom extension not available'); +if (LIBXML_VERSION < 20900) die('skip this test is for libxml >= 2.9.0 only'); +if (defined('LIBXML_BIGLINES')) die('skip this test is for LIBXML_BIGLINES being undefined'); +?> +--FILE-- +<?php +define('LIBXML_BIGLINES', 1<<22); +$foos = str_repeat('<foo/>' . PHP_EOL, 65535); +$xml = <<<XML +<?xml version="1.0" encoding="UTF-8"?> +<root> +$foos +<bar/> +</root> +XML; +$dom = new DOMDocument(); +$dom->loadXML($xml, LIBXML_BIGLINES); +var_dump($dom->getElementsByTagName('bar')->item(0)->getLineNo()); +?> +--EXPECT-- +int(65540) |
