Comments (3)
I've made an ugly change in "ManipulationTrait.php:694" and seems ok to me. at least I don't get fatal error and interruption now.
public function getHtml(): string {
$result = $this->collection();
if(method_exists($result, "first")) $result = $result->first(); else return "";
if(method_exists($result, "contents")) $result = $result->contents(); else return "";
if(method_exists($result, "reduce")) $result = $result->reduce(function($carry, $node) {
return $carry . $this->document()->saveHTML($node);
}, ''); else return "";
return $result;
}
from php-dom-wrapper.
Could you provide a document along with code to recreate the error?
from php-dom-wrapper.
Sorry I don't know which document or which url causing this error. But it's obvious you chaining methods without controlling them. You should check before calling a method is it really a method or callable or null result? If one of them returns null everything else will mess up.
from php-dom-wrapper.
Related Issues (20)
- Wrong encoding when add elements with text HOT 1
- Proper composer install with composer require? HOT 1
- Why do getHtml() and getOuterHtml() only work on the first child? HOT 1
- update symfony/css-selector to v5.0 HOT 1
- Access level to DOMWrap\Traits\ManipulationTrait::inputAsNodeList() must be public (as in class DOMWrap\Traits\TraversalTrait)
- Uncaught Error: Call to a member function isRemoved() on null HOT 2
- Your Tests are lying ;)
- Ubuntu 20.04/18.04 parsing doesn't work
- Elements get duplicated HOT 1
- [PHP 8] Deprecated: Function libxml_disable_entity_loader() is deprecated
- 2.0 migration guide HOT 1
- New features addBack() and getOuterHtml() ?
- Any way to use PHP DOM Wrapper without Composer? HOT 1
- PHP 8.1 "Deprecated" errors
- disable attribute encoding HOT 2
- Charset detection bug when decoding unformatted html... HOT 1
- It required PHP 8.0.2 HOT 2
- Deprecated: mb_convert_encoding
- This is removing text using html() function, I think it's a bug
- Fatal error: with DOMDocument::prepend(...$nodes): void in HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-dom-wrapper.