Skip to content

Confusing warning when blocking entity loading via libxml_set_external_entity_loader #11952

Closed
@nielsdos

Description

@nielsdos

Description

The following code:

<?php

libxml_set_external_entity_loader(function ($public_id, $system_id, $context) {
    return null;
});

$doc = new DOMDocument;
$doc->loadHTMLFile("foobar");

Resulted in this output:

Warning: DOMDocument::loadHTMLFile(): Failed to load external entity "NULL" in %s on line %d

But I expected something less confusing. Now it sounds like it tries to load a file named "NULL" but that is not the case. It just complains in a weird way.
Low priority issue though.

PHP Version

8.1+

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions