phantommagick icon indicating copy to clipboard operation
phantommagick copied to clipboard

Gets stuck when trying to generate certain html

Open BARNZ opened this issue 7 years ago • 0 comments

The function Converter->pushContent() does the following:

// @file_get_contents will not throw any exception due to @ symbol
// file_get_contents will try to load file from physical path or from an URL
// and will return the content as string
// If failed, it will return false.

$content = @file_get_contents($page);

This fails for me on Windows 10 + PHP7.1 when $page is a raw html string (it just times out, with no error message). Weirdly certain html will work fine, and some wont.

As a workaround I just added this check in:

// Try fetch the content if url or file
if (filter_var($page, FILTER_VALIDATE_URL) || file_exists($page)) {
    $content = @file_get_contents($page);
}

BARNZ avatar Jan 16 '18 14:01 BARNZ