[php-src] PR #11927: Handle libxml2 OOM more consistently
| From: | nielsdos | Date: | Wed, 09 Aug 2023 21:02:10 +0000 |
| Subject: | [php-src] PR #11927: Handle libxml2 OOM more consistently | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-23334@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/11927
Author: nielsdos
See https://github.com/php/doc-en/issues/1741 for
some background
This is a continuation of commit c2a58ab07d, in which several OOM error handling was converted to
throwing an INVALID_STATE_ERR DOMException. Some places were missed and they still returned false
without an exception, or threw a PHP_ERR DOMException.
Convert all of these to INVALID_STATE_ERR DOMExceptions. This also reduces confusion of users going
through documentation [1].
Unfortunately, not all node creations are checked for a NULL pointer. Some places therefore will not
do anything if an OOM occurs (well, except crash).
On the one hand it's nice to handle these OOM cases. On the other hand, this adds some
complexity and it's very unlikely to happen in the real world. But then again,
"unlikely" situations have caused trouble before. Ideally all cases should be checked.
[1] https://github.com/php/doc-en/issues/1741
**NOTE:** since we don't handle all OOM cases, maybe the wording in UPGRADING should be
relaxed.