Bug 249886 - lang/php74: DOM support not enabled
Summary: lang/php74: DOM support not enabled
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Torsten Zuehlsdorff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-25 13:53 UTC by michael.glaus
Modified: 2020-10-09 12:51 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (tz)


Attachments
File to test the issue (89 bytes, text/plain)
2020-09-25 13:53 UTC, michael.glaus
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description michael.glaus 2020-09-25 13:53:21 UTC
Created attachment 218281 [details]
File to test the issue

On php74 with the extensions php74-dom and php74-xmlreader enabled, certain php functions will result in a warning "PHP Warning:  DOM support is not enabled".

If php74 is built with the "--enable-dom" and "--enable-xmlreader" configuration arguments and the two extensions are not installed, these functions work without a warning.

On other php versions it works without the arguments and on other operating systems php74 works too.

To test this, execute the attached file.

See also:
https://github.com/awesomemotive/one-click-demo-import/issues/207
Comment 1 Torsten Zuehlsdorff freebsd_committer 2020-09-25 23:09:40 UTC
I am afraid i can't follow or replicate this description at the moment. So please help me to understand:

* You installed lang/php74? Via pkg?
* You also installed textproc/php74-dom via pkg?

If so, it works great for me. :D Because installing textproc/php74-dom is exactly using "--enable-dom" as configure flag for PHP 7.4.

If this still fails i need:
* the specific functions used which issues a warning?
* The output of "php -m"
* The output of pkg info | grep php

The link describes a wrong usages of the PHP modules. A simple "pkg install textproc/php74" is enough to get it work! :)
Comment 2 Tatsuki Makino 2020-09-25 23:20:58 UTC
The expansion is independent.
DOM exists in textproc/php74-dom.
XMLREADER exists in textproc/php74-xmlreader.
If you install lang/php74-extensions, they are installed by default.
if php74-dom and php74-xmlreader are already installed, they are enabled in the ini of --with-config-file-scan-dir.
--with-config-file-scan-dir is ${PREFIX}/etc/php. It is usually /usr/local/etc/php.
But that can be overridden by the environment variable PHP_INI_SCAN_DIR.
If result of php -r 'var_dump(php_ini_scanned_files());' does not include ext-20-dom.ini, something is wrong.
Comment 3 michael.glaus 2020-09-28 08:13:56 UTC
(In reply to Torsten Zuehlsdorff from comment #1)

I installed php74, php74-dom and php74-xmlreader via pkg.
Then i executed the attached script. This generated the warning.

The function that causes the warning is expand() from the class XMLReader, which is provided by the xmlreader extension.

Additional infos:
php -m

[PHP Modules]
Core
date
dom
hash
libxml
mysqlnd
pcre
Reflection
SPL
standard
xmlreader

[Zend Modules]

pkg info | grep php

php74-7.4.10                   PHP Scripting Language
php74-dom-7.4.10               The dom shared extension for php
php74-xmlreader-7.4.10         The xmlreader shared extension for php
Comment 4 churchers 2020-10-08 08:16:11 UTC
I came here to report the same problem but see it already exists (didn't find this page when I was trying to diagnose the error in the first place....)

php73-xmlreader lists php73-dom as a build dependency. php74-xmlreader does not. I'm not sure why but it seems something has changed that has caused the xmlreader module to be built without --with-dom enabled. 

This isn't simply a case of requiring the pkg. Even having both php74-dom and php74-xmlreader installed doesn't work as the xmlreader module needs to be able to see the dom module at build time.*

----------------------------
1108 /* {{{ proto bool XMLReader::expand()
1109 Moves the position of the current instance to the next node in the stream. */
1110 PHP_METHOD(xmlreader, expand)
1111 {
1112 #ifdef HAVE_DOM
...
1150 #else
1151         php_error(E_WARNING, "DOM support is not enabled");
1152         return;
1153 #endif
----------------------------

Unfortunately this causes various applications to break (A Wordpress theme brought it to my attention but there are other reports on the Internet). The only option to use 7.4 is to build from source which isn't really ideal.
Comment 5 sam 2020-10-08 20:12:29 UTC
I am also having issues with this bug, some more information on the forums here: https://forums.freebsd.org/threads/php-7-4-dom-support-not-enabled.77228/
Comment 6 Torsten Zuehlsdorff freebsd_committer 2020-10-08 20:37:52 UTC
Thank you all for the additional explanation! :) I see what you mean. Will check how to fix it :)
Comment 7 commit-hook freebsd_committer 2020-10-08 21:08:18 UTC
A commit references this bug:

Author: tz
Date: Thu Oct  8 21:08:00 UTC 2020
New revision: 551733
URL: https://svnweb.freebsd.org/changeset/ports/551733

Log:
  lang/php74: Add missing dependency from php74-xmlreader to php74-dom

  xmlreader needs not only the DOM extension, but to be compiled
  with --enabled-dom. This commit adds the missing configuration
  to etablish the dependency.

  PR:		249886
  Submitted by:	michael.glaus@hostpoint.ch
  Sponsored by:	Bounce Experts

Changes:
  head/lang/php74/Makefile.ext
Comment 8 commit-hook freebsd_committer 2020-10-08 21:17:20 UTC
A commit references this bug:

Author: tz
Date: Thu Oct  8 21:16:39 UTC 2020
New revision: 551734
URL: https://svnweb.freebsd.org/changeset/ports/551734

Log:
  MFH: r551733

  lang/php74: Add missing dependency from php74-xmlreader to php74-dom

  xmlreader needs not only the DOM extension, but to be compiled
  with --enabled-dom. This commit adds the missing configuration
  to etablish the dependency.

  PR:		249886
  Submitted by:	michael.glaus@hostpoint.ch
  Sponsored by:	Bounce Experts

  Approved by:	ports-secteam (joneum, implicit for PHP Updates)

Changes:
_U  branches/2020Q4/
  branches/2020Q4/lang/php74/Makefile.ext
Comment 9 Torsten Zuehlsdorff freebsd_committer 2020-10-08 21:18:50 UTC
This shoud be fixed now. I also merged it into the quarterly branch :)
Comment 10 michael.glaus 2020-10-09 12:51:40 UTC
Thank you for the fix. It works for my issue.