j0k3r / php-readability

A fork of https://bitbucket.org/fivefilters/php-readability
Apache License 2.0
168 stars 36 forks source link

PHP Notice: Trying to get property of non-object #17

Closed luxifer closed 7 years ago

luxifer commented 8 years ago
PHP Notice:  Trying to get property of non-object in src/Readability.php on line 768

I don't have much insights. This is when I run the wallabag Redis importer. I'll try to see which html document.

j0k3r commented 8 years ago

If you could get me which link generate that it'll help me a lot :)

j0k3r commented 8 years ago

Here are some output (from a redis import on wallabag):

[2016-10-10 15:13:31] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.scmp.com/magazines/style/article/1873813/luxury-brands-are-turning-mixologists-create-special-drinks-give","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:13:46] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/retail-news/designer-luxury/chou-controlling-interest-thakoon-10295681/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:13:49] app.WARNING: Unable to parse entry {"entry":{"url":"http://gulfnews.com/business/sectors/automotives/wealthy-iranians-spur-luxury-car-boom-1.1012136","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
PHP Notice:  Trying to get property of non-object in /media/hdd2/home_b/arnaud/websites/wallabag/vendor/j0k3r/php-readability/src/Readability.php on line 768
PHP Notice:  Trying to get property of non-object in /media/hdd2/home_b/arnaud/websites/wallabag/vendor/j0k3r/php-readability/src/Readability.php on line 768
[2016-10-10 15:14:01] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/beauty-industry-news/beauty-features/unilever-braces-for-tougher-market-conditions-10319625/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:14:26] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.boursier.com/actions/actualites/news/prada-coup-de-pouce-chinois-542171.html","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:14:31] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.shanghaidaily.com/Business/finance/Ordinary-goods-sell-well-but-luxury-dips/shdaily.shtml","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:14:38] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.fashiontimes.com/articles/21781/20150618/burberry-designer-christopher-bailey-featured-wall-street-journal.htm","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:15:07] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.shankennewsdaily.com/index.php/2015/10/02/13470/exclusive-industry-stars-highlight-impacts-blue-chip-brands/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:23:32] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.shankennewsdaily.com/index.php/2014/11/10/11048/wine-spectator-to-unveil-top-100-wines-of-2014/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:23:32] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.thedrinksbusiness.com/2014/11/mick-jagger-shakes-hips-at-aussie-winery/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:23:55] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.ey.com/Publication/vwLUAssets/EY-africa-attractiveness-survey-2015-making-choices/$FILE/EY-africa-attractiveness-survey-2015-making-choices.pdf","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:01] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.parischerie.com/31905/high-fashion-on-the-eiffel-tower/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:05] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.lecho.be/les_marches/live_blog/Kering_aurait_trouve_un_acheteur_pour_sa_participation_dans_Puma.9563108-2970.art","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:09] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.20min.ch/ro/economie/news/story/28708233","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:09] app.WARNING: Unable to parse entry {"entry":{"url":"http://brandchannel.com/index.phppost.aspx?id=f8bba14b-48c7-4289-8782-3034f880765a","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:09] app.WARNING: Unable to parse entry {"entry":{"url":"https://www.sprinklr.com/content-download-confirmation/?submissionGuid=7863609f-6aff-4496-9ac7-a1f30638f2e2","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:09] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/retail-news/retail-features/think-tank-bomoda-brian-buchwald-andrew-roth-international-retail-10260664/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:09] app.WARNING: Unable to parse entry {"entry":{"url":"http://www.chaussure-de-luxe.com/Spectre-James-Bond-sauve-le-monde-en-Crockett-Jones_a487.html","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:10] app.WARNING: Unable to parse entry {"entry":{"url":"http://en.pambianconews.com/2015/09/03/bofs-global-fashion-school-rankings-londons-central-st-martins-tops-the-list/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:10] app.WARNING: Unable to parse entry {"entry":{"url":"http://en.pambianconews.com/2015/09/09/luxury-companies-re-thinks-china-retail-strategy/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:10] app.WARNING: Unable to parse entry {"entry":{"url":"http://en.pambianconews.com/2015/09/16/chanel-posts-record-38-profit-increase/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:10] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/retail-news/specialty-stores/kendra-scotts-customer-centric-approach-10254520/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:10] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/media-news/publishing/josh-tyrangiel-leaving-bloomberg-10248830/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:11] app.WARNING: Unable to parse entry {"entry":{"url":"http://luxurysociety.com/articles/2015/09/the-future-of-wealthy-chinese-travelers-luxury-spend","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:12] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/business-news/financial/target-drops-cherokee-brand-10216144/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:15] app.WARNING: Unable to parse entry {"entry":{"url":"http://luxurysociety.com/articles/2015/08/the-luxury-snapshot-footwear-accessories-winners","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:15] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/accessories-news/technology/android-smartwatches-now-work-with-iphone-10208243/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:15] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/beauty-industry-news/beauty-features/ewg-brazilian-blowouts-poisonous-10204874/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:15] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/business-news/financial/urban-outfitters-earnings-10203196/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:17] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/markets-news/marketing-trends/costume-designers-discuss-retailers-brands-10202897/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:17] app.WARNING: Unable to parse entry {"entry":{"url":"http://hypebeast.com/2015/8/who-is-nick-wooster","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:17] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/business-news/human-resources/target-john-mulligan-coo-cathy-smith-cfo-10202952/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:17] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/menswear-news/sportswear/seven-for-all-mankind-foolproof-jeans-10203200/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
[2016-10-10 15:24:20] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/business-news/government-trade/abercrombie-settles-itc-laser-denim-case-10193525/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} 
PHP Notice:  Trying to get property of non-object in /media/hdd2/home_b/arnaud/websites/wallabag/vendor/j0k3r/php-readability/src/Readability.php on line 768
[2016-10-10 15:24:28] app.WARNING: Unable to parse entry {"entry":{"url":"http://wwd.com/markets-news/denim/npd-study-millennials-denim-10190423/","title":null,"status":null,"is_archived":false,"is_starred":false,"content_type":"","language":"","userId":1}} ```
j0k3r commented 8 years ago

I can't reproduce even with the previous log. @luxifer if you can provide me a link, otherwise I can push a temporary fix but I won't be able to check for side effects ...

feuzeu commented 7 years ago

I think I've reproduced this issue, while trying to process this webpage: http://www.ayyaantuu.net/ethiopia-targets-opposition-lawmakers/. The $childNode variable at line 768 in Readability.php is null, hence the error message. The issue disapears if I check if the variable is not null before it is used.

j0k3r commented 7 years ago

@feuzeu thanks for the link ! I've created a PR with a fix

luxifer commented 7 years ago

sorry, I forgot that issue... I'll see if I can find again the page that triggered the error.