technosophos / querypath

QueryPath is a PHP library for manipulating XML and HTML. It is designed to work not only with local files, but also with web services and database resources.
http://querypath.org
Other
822 stars 114 forks source link

Fatal error when using ->after() with empty string #162

Closed aaemnnosttv closed 9 years ago

aaemnnosttv commented 9 years ago

This code will produce a fatal error if $insert is empty.

$content = htmlqp($html);
$content->find('>p')->eq($insert_index)->after($insert);
Fatal error: Call to a member function cloneNode() on a non-object
Querypath/QueryPath/DOMQuery.php on line 1439

QueryPath 3.0.3

technosophos commented 9 years ago

Thanks. I'll take a look. While it's probably not highly relevant, which version of PHP are you using?