GithubHelp home page GithubHelp logo

Comments (6)

j0k3r avatar j0k3r commented on May 28, 2024

Could you give me the content or url your were using to reproduce the bug?

from php-readability.

MikeIvantsov avatar MikeIvantsov commented on May 28, 2024

http://iosgames.ru/?p=22030

from php-readability.

j0k3r avatar j0k3r commented on May 28, 2024

Thanks I'll take a closer look.

from php-readability.

MikeIvantsov avatar MikeIvantsov commented on May 28, 2024

I think the problem at the code between 530 and 560 lines : $iframe->item(0)->nodeValue = ' '

from php-readability.

j0k3r avatar j0k3r commented on May 28, 2024

Could you give me a snippet how to reproduce the bug?
I've tried with that:

<?php

require 'vendor/autoload.php';

$url = 'http://iosgames.ru/?p=22030';
$data = file_get_contents($url);

$readability = new \Readability\Readability($data, $url);
$result = $readability->init();

var_dump($result, $readability); die();

And I didn't get any errors.
Which version of PHP are you using? Did you have the tidy extension installed?

from php-readability.

MikeIvantsov avatar MikeIvantsov commented on May 28, 2024

PHP 5.3.10-1ubuntu3.19
Tidy support => enabled
libTidy Release => 25 March 2009
Extension Version => 2.0

Try that:

function error2Exception($code, $string, $file, $line, $context)
{
    throw new Exception($string, $code);
}
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
set_error_handler('error2Exception', E_ALL | E_STRICT);

require 'vendor/autoload.php';

$url = 'http://iosgames.ru/?p=22030';
$data = file_get_contents($url);

$readability = new \Readability\Readability($data, $url);
$result = $readability->init();

var_dump($result, $readability); die();

Exception from my script:

PHP Fatal error: Uncaught exception 'Exception' with message 'DOMDocumentFragment::appendXML(): Entity: line 3: parser error : Entity 'nbsp' not defined' in test.php:14
Stack trace:
#0 [internal function]: error2Exception(2, 'DOMDocumentFrag...', '/home/www/libs/...', 57, Array)
#1 /home/www/libs/php-readability/src/JSLikeHTMLElement.php(57): DOMDocumentFragment->appendXML('<div class="ent...')
#2 /home/www/libs/php-readability/src/Readability.php(559): Readability\JSLikeHTMLElement->__set('innerHTML', '<div class="ent...')
#3 /home/www/libs/php-readability/src/Readability.php(911): Readability\Readability->prepArticle(Object(Readability\JSLikeHTMLElement))
#4 /home/www/libs/php-readability/src/Readability.php(291): Readability\Readability->grabArticle()
#5 test.php(27): Readability\Readability->init()
#6 {main}
thrown in test.php on line 14

from php-readability.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.