Actions
Bug #5943
openXSLT through SaxonC PHP gives "Segmentation fault"
Start date:
2023-03-28
Due date:
% Done:
0%
Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
12.0
Fixed in version:
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:
Description
Hi all,
We've upgraded our SaxonC PHP library to Saxon 12(.1), but it gives a segmentation fault (error code 139 with PHPUnit) when it runs 2 or more transformations after each other. This happens in version 12.1, but also happened in version 12. We use PHP 8.1 (FPM).
We use a factory to construct and destruct a SaxonProcessor
instance:
use Saxon\SaxonProcessor;
class SaxonProcessorFactory
{
private ?SaxonProcessor $saxonProcessor = null;
public function __destruct()
{
if (null !== $this->saxonProcessor) {
$this->saxonProcessor = null;
}
}
public function get(): SaxonProcessor
{
if (null === $this->saxonProcessor) {
$this->saxonProcessor = $this->create();
}
return $this->saxonProcessor;
}
private function create(): SaxonProcessor
{
$saxonProcessor = new SaxonProcessor();
$saxonProcessor->setConfigurationProperty('http://saxon.sf.net/feature/recognize-uri-query-parameters', 'true');
return $saxonProcessor;
}
}
Then we use that processor to do XSLT transformations:
$saxonProcessor = $this->saxonProcessorFactory->get();
$transformer = $saxonProcessor->newXslt30Processor();
foreach ($parameters as $key => $value) {
$transformer->setParameter($key, $saxonProcessor->createAtomicValue($value));
}
$transformer->transformFileToFile($tmpFilePath, $xsltFilePath, $outputFile->getPath());
if ($transformer->exceptionOccurred()) {
$exception = SaxonXsltTransformException::forXslTransformation($transformer, $tmpFilePath, $xsltFilePath);
$transformer = null;
throw $exception;
}
$transformer = null;
The first time it runs fine (through for example unit tests), but the second time it gives a segmentation fault. I'm unable to debug this into a specific line or something that created the segmentation fault.
Are you guys able to help us out?
Please register to edit this issue
Actions