php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81694 DOMDocument is not available on 7.4 with configure --disable-all --with-libxml
Submitted: 2021-12-03 15:12 UTC Modified: 2021-12-03 17:36 UTC
From: divinity76 at gmail dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 7.4.26 OS: Amazon Linux 2 (RHEL-like)
Private report: No CVE-ID: None
 [2021-12-03 15:12 UTC] divinity76 at gmail dot com
Description:
------------
when compiling PHP7.4 like this:

rm -rf php-src && \
git clone -b 'PHP-7.4' --depth 1 https://github.com/php/php-src.git && \
cd 'php-src' && \
./buildconf && \
./configure --disable-all --disable-cgi --enable-cli --with-libxml && \
make clean && \
make -j $(nproc) && \
rm -rfv ../php && \
cp -v ./sapi/cli/php ../php


the resulting php binary does not have DOMDocument available.. i'm pretty sure DOMDocument is supposed to be there when --with-libxml is provided? i guess its a bug with the combo --disable-all + --with-libxml ? 



Test script:
---------------
./php -r 'new DOMDocument;'

Expected result:
----------------
(blank)

Actual result:
--------------
[root@ip-192-168-1-1 php]# cat compile_bugreport.sh
yum install autoconf bison re2c libxml2 gcc && \
rm -rf php-src && \
git clone -b 'PHP-7.4' --depth 1 https://github.com/php/php-src.git && \
cd 'php-src' && \
./buildconf && \
./configure --disable-all --disable-cgi --enable-cli --with-libxml && \
make clean && \
make -j $(nproc) && \
rm -rfv ../php && \
cp -v ./sapi/cli/php ../php
[root@ip-192-168-1-1 php]# ./php -r 'new DOMDocument;'

Fatal error: Uncaught Error: Class 'DOMDocument' not found in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-12-03 15:21 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: *XML functions +Package: DOM XML related
 [2021-12-03 15:21 UTC] requinix@php.net
You said to --disable-all. That does exactly what it sounds like it does.
 [2021-12-03 15:41 UTC] cmb@php.net
Add `--enable-dom`.
 [2021-12-03 16:44 UTC] divinity76 at gmail dot com
@requinix sure, but --disable-all isn't suppose to disable following things that are explicitly enabled, for example if you do `./configure --disable-all --with-curl` then you still get a php with curl_*

@cmb indeed --enable-dom fixed the issue! thanks! wonder if --enable-dom should be explicitly mentioned on https://www.php.net/manual/en/dom.installation.php
 [2021-12-03 17:06 UTC] cmb@php.net
> wonder if --enable-dom should be explicitly mentioned

If at all, then there could be general info about that.  If there
is --enable-*, then there is automatically --disable-*, and vice
versa.  Same for --with-* and --without-*.
 [2021-12-03 17:36 UTC] requinix@php.net
> -disable-all isn't suppose to disable following things that are explicitly enabled,

libxml is not the DOM extension. It is the underlying library used to power PHP's multiple DOM and XML-based extensions. Enabling DOM implies enabling libxml, but enabling libxml does not imply enabling DOM.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC