Skip to content

Confusing warning when blocking entity loading via libxml_set_external_entity_loader #11952

Closed

Description

@ndossche

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

Activity

  1. added a commit that references this issue on Aug 22, 2023
    d19eba1
  2. added a commit that references this issue on Jan 31, 2024
    e1cb721
  3. added 3 commits that reference this issue on Sep 8, 2025
    6a2adcd
    cc4cfbf
    2d11f4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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