Skip to content

File name is longer than the maximum allowed path length on this platform (4096) #18

@ddjikic

Description

@ddjikic

i am trying to load a string

use PHPHtmlParser\Dom;

$dom = new Dom;
$dom->load('A HUGE HTML STRING ');
$a = $dom->find('a')[0];
echo $a->text; // "click here"

and i get the error

is_file(): File name is longer than the maximum allowed path length on this platform (4096):

i think that you should create a function or give access to loadStr widouth checking if it is a file or not

    public function load($str, $options = [])
    {
        // check if it's a file
        if (is_file($str))
        {
            return $this->loadFromFile($str, $options);
        }
        // check if it's a url
        if (preg_match("/^https?:\/\//i",$str))
        {
            return $this->loadFromUrl($str, $options);
        }

        return $this->loadStr($str, $options);
    }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions