Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mcfog opened this issue Nov 3, 2019 · 2 comments

Comments

@mcfog
Copy link

mcfog commented Nov 3, 2019

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.

@gabrielmuresan
Copy link

     [exec] PHP Version: 7.3.12 (Darwin)
     [exec] PHPDox Version: 0.12.0-dev
     [exec] ErrorException: E_WARNING 
     [exec] Location: /Volumes/OfficeExternalHDD/office/projects/recipe-system-api/vendor/theseer/fxsl/src/fxsltprocessor.php (Line 192)
     [exec] 
     [exec] XSLTProcessor::transformToDoc(): No stylesheet associated to this object
     [exec] 
     [exec] No stacktrace available

I also built the PHP binary using phpbrew and I can confirm the above solution works.
Thank you, @mcfog !

@theseer
Copy link
Owner

theseer commented Mar 8, 2020

Thanks for the heads up! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants