support of compileFromStringAndSave / compileFromFileAndSave + PHP5 build
Hi Saxonica team,
We would like to use the latest Saxon-HEC release, 1.1.2, that is supposed to bring support for compileFromStringAndSave / compileFromFileAndSave methods.
Unfortunately we have ran into issues with:
building for PHP5: Fortunately, fix seems to be obvious: getUnderlyingValue() takes not arguments (see the attached patch)
building for PHP5 w/ support for compileFromStringAndSave / compileFromFileAndSave methods: it seems that these features where added to PHP7 only. I tried to port it to PHP5, which was OK to compile & link (see attached patch)
using compileFromFileAndSave(): resulted in a segfault. I can't tell if it that's my patch that is wrong or something happening in the JET Saxon library...
output: xml error0
JET RUNTIME HAS DETECTED UNRECOVERABLE ERROR: system exception at 0x00000000007026ee Please, contact the vendor of the application.
From the coredump:
PHP & module are not built with debugging symbols so backtrace lacks info: #0 0x00007fe9f8ed5067 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007fe9f8ed6448 in __GI_abort () at abort.c:89 #2 0x00007fe9e8fa6b74 in ?? () from /usr/lib/libsaxonhec.so #3 0x0000000000000000 in ?? ()
And JET log: Signal 11 (SIGSEGV) siginfo: si_signo 11, si_errno 0, si_code 1, si_addr 0x0000000000000000 ...
I can provide you with more info if needed.
- it seems to me that even PHP7 misses some bits to get support of compileFromStringAndSave / compileFromFileAndSave methods: they should be registered into zend_function_entry XsltProcessor_methods, shouldn't they ?
We would be glad to be have to use these methods in both php5 and php7 versions. Please feel free to ask for more info & test if needed.
#2 Updated by O'Neil Delpratt over 1 year ago
- Status changed from New to In Progress
- Found in version set to 1.1.2
Thanks for reporting the issue you have found.
Firstly, As you mentioned the PHP code is incomplete. These methods need to be added to the 'XsltProcessor_methods'. I will fix this and commit to subversion.
Secondly, the methods to create a SEF file compileFromStringAndSave and compileFromFileAndSave require Saxon-EE/C. Saxon-HE/C can be used to load the SEF files once created. This is probably the cause of the Seg Error. I will investigate this further. This should in no doubt fail more cleanly.
#4 Updated by O'Neil Delpratt over 1 year ago
the following exception is probably the cause of why this method is failing:
net.sf.saxon.s9api.SaxonApiException: Exporting a package is only possible if just-in-time compilation is disabled at net.sf.saxon.s9api.XsltPackage.save(Unknown Source) at net.sf.saxon.s9api.XsltPackage.save(Unknown Source) at net.sf.saxon.option.cpp.XsltProcessor.compileFromFileAndSave(Unknown Source) Caused by: net.sf.saxon.trans.XPathException: Exporting a package is only possible if just-in-time compilation is disabled at com.saxonica.ee.trans.StylesheetPackageEE.export(Unknown Source) ... 3 more
It would be good to switch on and off Just-In-Time compilation via the C++/PHP API. I have created another bug issue to track this: #4156
As mentioned in the bug issue the workaround is as follows:
#5 Updated by sébastien bocahu over 1 year ago
I tried (still using Saxon-HEC) but still got a segfault:
$saxonProc = new Saxon\SaxonProcessor(); $saxonProc->setConfigurationProperty("http://saxon.sf.net/feature/optimizationLevel","-j"); $xsltProc = $saxonProc->newXsltProcessor(); $xsltProc->setSourceFromFile($xmlFile); $xsltProc->compileFromFileAndSave($xslFile, $xslFile.".sef");
#6 Updated by O'Neil Delpratt over 1 year ago
As mentioned in comment #2. The exporting feature is not available in Saxon-HE/C, you will require Saxon-EE/C. You can get an evaluation license to try it out
Then you can use the following code:
$saxonProc = new Saxon\SaxonProcessor(true); $saxonProc->setConfigurationProperty("http://saxon.sf.net/feature/optimizationLevel","-j"); $xsltProc = $saxonProc->newXsltProcessor(); $xsltProc->setSourceFromFile($xmlFile); $xsltProc->compileFromFileAndSave($xslFile, $xslFile.".sef");
Please register to edit this issue