php / php/doc-en

Internal error handling of ext/libxml needs better documentation

Open
#2,595 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Extension: libxml Status: Verified
Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

Description

The following code:
https://3v4l.org/8vJBH

<?php

$dom = new DOMDocument();
if (!$dom->loadXML('<malformed></mlfrm>')) {
    print_r(libxml_get_errors());
}

Resulted in this output:

Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: malformed line 1 and mlfrm in Entity, line: 1 in /in/8vJBH on line 4
Array
(
)

But I expected this output instead:

Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: malformed line 1 and mlfrm in Entity, line: 1 in /in/8vJBH on line 4
Array
(
    [0] => ... LibXMLError object ...
)
PHP Version

any

Operating System

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the PHP documentation for DOMDocument::loadXML(), libxml_get_errors(), and the ext/libxml error-handling behavior shown in the issue's example. Compare the documented expectations with the reported output; the work is done when the relevant documentation clearly explains whether errors are collected and how to retrieve them.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.