Skip to content

use XSLTProcessor::hasExsltSupport to detect dependency problem around libexsl #379

Open
@mcfog

Description

@mcfog

run into something like #255 again on my mac today with some error information like

PHP Version: 7.2.18 (Darwin)
PHPDox Version: 0.12.0
ErrorException: E_WARNING
Location: phar:///usr/local/bin/phpdox/vendor/theseer/fxsl/src/fxsltprocessor.php (Line 192)

XSLTProcessor::transformToDoc(): No stylesheet associated to this object

No stacktrace available

I thought I find the problem why it's hard to reproduce by someone, it's related to php build flags. I build my own php binary on my machine (with phpbrew). It seems like phpdox depends on some feature inside EXSLT somehow and a simple --with-xsl build flag leads to a build that support XSL but not EXSLT somehow.

I solved this on my machine by a brew install libxslt and rebuild php with flag --with-xsl=$(brew --prefix libxslt),it can be verified via diff of php -i looks like

834,835c834,837
< libxslt Version => 1.1.29
< libxslt compiled against libxml Version => 2.9.4
---
> libxslt Version => 1.1.33
> libxslt compiled against libxml Version => 2.9.9
> EXSLT => enabled
> libexslt Version => 1.1.33
940,941c942,943

In PHP layer, I found https://www.php.net/manual/en/xsltprocessor.hasexsltsupport.php can also detect this

>>> $proc = new XSLTProcessor;
=> XSLTProcessor {#2304}
>>> $proc->hasExsltSupport()
=> true

So some detailed documentation about the EXSLT dependency and / or runtime detection with XSLTProcessor::hasExsltSupport maybe a good solution to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions