Comments (20)
Yeah, I did notice this earlier. It's quite weird. It seems like an issue with hhvm.
from parsedown-extra.
We should skip that check if we're on hhvm so that we can still run parsedown. It's causing my entire test suite to crash atm. :(
from parsedown-extra.
Does #43 look like a quick fix for now?
from parsedown-extra.
I'd rather have the part of the test that causes the warning removed. Perhaps, we should also report the issue to the hhvm team.
from parsedown-extra.
I think they know about it already. They haven't implemented those methods yet, that's all.
from parsedown-extra.
Another option would be to not support hhvm until the issue is resolved.
from parsedown-extra.
If you did that, people would just move away from your library, inc me. moving my laravel wrapper.
from parsedown-extra.
This might never be resolved in hhvm btw. They might be choosing not to support this.
from parsedown-extra.
Ok, I'll see what I can do.
from parsedown-extra.
Also, I just tried out my "fix", and it doesn't work.
from parsedown-extra.
We are having these problems reported over at OctoberCMS too. Correct me if I'm wrong here guys, but a text node (DOMText) shouldn't contain attributes anyway.
if ($DOMDocument->documentElement->hasAttributes() && $DOMDocument->documentElement->getAttribute('markdown') === '1')
Checking if said element "hasAttributes()" first might be a more logical fix? Also, the next else expression would be wise to check for child nodes too.
elseif ($DOMDocument->documentElement->hasChildNodes())
Full method is here.
If HHVM are being really conservative, they might not have included hasAttributes()
on a DOMText node either, because "Duh it's a text node" so this can also be tested:
if ((!$DOMDocument->documentElement instanceof \DOMText) && $DOMDocument->documentElement->getAttribute('markdown') === '1')
from parsedown-extra.
@daftspunk Could you create a pull request?
from parsedown-extra.
@hkdobrev Can you confirm that any of these proposals work first? I am unaffected by this issue and am unable to confirm.
from parsedown-extra.
I have this issue with OctoberCMS, I have tried solutions proposed by daftspunk. After a bit of research I've found out what follows:
- adding hasAttributes() check does not help, hhvm paradoxically returns true for text nodes, so I get same error, no getAttribute method on DOMText,
- adding:
if (method_exists($DOMDocument->documentElement, 'getAttributes') && $DOMDocument->documentElement->getAttribute('markdown') === '1'))
or
if ((!$DOMDocument->documentElement instanceof \DOMText) && $DOMDocument->documentElement->getAttribute('markdown') === '1')
check helps with missing DOMText::getAttribute, but causes new error:
"Cannot access property on non-object" on line 473 of /srv/www/workbench/october/vendor/erusev/parsedown-extra/ParsedownExtra.php
which is
$DOMDocument->replaceChild($DOMDocument->firstChild->firstChild->firstChild, $DOMDocument->firstChild);
Commenting out this line causes stack overflow on line 496:
$elementText .= $this->processTag($nodeMarkup);
Adding elseif ($DOMDocument->documentElement->hasChildNodes()) check proposed by daftspunk does not seem to help. Even doing something as stupid as:
if (property_exists($DOMDocument, 'firstChild') && property_exists($DOMDocument->firstChild, 'firstChild') && property_exists($DOMDocument->firstChild->firstChild, 'firstChild')) {
$DOMDocument->replaceChild($DOMDocument->firstChild->firstChild->firstChild, $DOMDocument->firstChild);
}
does not help with this loop. HHVM 3.5.1 here.
from parsedown-extra.
Thanks @keiosweb, the issue appears to be more complex than I thought. Might need attention from the author or from someone with more intimate knowledge of the logic.
from parsedown-extra.
@keiosweb Thanks for the comment. It's an important issue. I'll look into it as soon as can. Hopefully, later this month.
from parsedown-extra.
Did this end up fixed?
from parsedown-extra.
No idea. I've lost interest.
from parsedown-extra.
@daftspunk It probably is - HHVM should be quite mature by now - I'd guess it has "learned" to execute the code without producing an error.
from parsedown-extra.
@keiosweb where can i add this
if (method_exists($DOMDocument->documentElement, 'getAttributes') && $DOMDocument->documentElement->getAttribute('markdown') === '1'))
i am having the same issue please... am using codeigniter
from parsedown-extra.
Related Issues (20)
- Undefined index: text HOT 4
- Paragraphs/HTML blocks may disappear in HTML block with markdown="1" HOT 3
- ParsedownExtra.php and tests classes are declared as psr-0 in composer.json but are not compliant with psr-0 HOT 11
- Bug: Uninitialized string offset: 1
- Footnote HTML is double-escaped when safe mode is on HOT 1
- Can't embed video HOT 1
- The Footnotes stop working
- I'm getting this while composer update/install HOT 2
- Multiline blockquotes not rendering correctly in multiline footnotes
- Multiple blockquotes HOT 1
- Video HTML tag does not work
- Parsing special attributes {lang=fr} are not parsed HOT 1
- List Item is dropping text that follows a custom tag HOT 2
- PHP 8.2: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated HOT 2
- Wrap image inside div - not working
- Demo broken? HOT 5
- Add support for PHP 8.2 HOT 2
- Deprecated: Use of "self" in callables is deprecated HOT 1
- Should we start looking for alternatives? Is this repo alive? HOT 1
- Deprecated: Use of "self" in callables is deprecated
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 parsedown-extra.