[php-src] Issue #12124: SIGSEGV in zend_mm_alloc_small while executing spl_perform_autoload with Saxon extension

From: Date: Tue, 05 Sep 2023 00:10:32 +0000
Subject: [php-src] Issue #12124: SIGSEGV in zend_mm_alloc_small while executing spl_perform_autoload with Saxon extension
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245330@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12124 Author: ttln ### Description Hi there, I am trying to use [Saxon](https://www.saxonica.com/download/c.xml) to run XSLT transformations from PHP. Saxon is an XSLT, XPath, and XQuery processor made by Saxonica. Saxonica produce a PHP extension that allows to call the processor from PHP. When I run a simple PHP script from the CLI, the transformation works successfully. When I run a transformation from PHPUnit or Symfony, I encounter a segmentation fault. The following code: ```php <?php $processor = new \Saxon\SaxonProcessor(); $input = file_get_contents(__DIR__.'/input.xml'); $xdmDoc = $processor->parseXmlFromString($input); $processor = $processor->newXslt30Processor(); $compiled = $processor->compileFromString( file_get_contents(__DIR__.'/template.xslt') ); $args = []; $result = $compiled->transformToString($xdmDoc); echo $result; ``` Resulted in this output: ```xml <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Books</title> </head> <body> <p> Title: XML Developer's Guide</p> [...] ``` Which is a successful transformation of that _input.xml_ with the XSL _transform.xslt_. However, when I run it inside PHPUnit or Symfony, I encounter an error. The following code: ```php <?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; class TestController extends AbstractController { // This is a non-working route, triggered by the use of SaxonProcessor // and the creation of a Response. // This works too with PHPUnit. #[Route('/test', name: 'app_test')] public function index(): Response { $processor = new \Saxon\SaxonProcessor(); $input = file_get_contents(__DIR__.'/../../input.xml'); $xdmDoc = $processor->parseXmlFromString($input); $processor = $processor->newXslt30Processor(); $compiled = $processor->compileFromString( file_get_contents(__DIR__.'/../../template.xslt') ); $args = []; $result = $compiled->transformToString($xdmDoc); // Below is the error trigger. // If you add 'echo $result; exit;', the transformed result will be shown correctly. $response = new Response($result); // Never reached. return $response; } } ``` Resulted in this output: ``` symfony command "PHP" failed: signal: segmentation fault, waiting 5 seconds before restarting it ``` But I expected this output instead: ```xml <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Books</title> </head> <body> <p> Title: XML Developer's Guide</p> [...] ``` I set up GDB, and attached it to my PHP process, and called the Symfony route again. This produced the following backtrace: ``` (gdb) continue Continuing. [New Thread 0x7f7ae79ff6c0 (LWP 128940)] Thread 1 "php" received signal SIGSEGV, Segmentation fault. zend_mm_alloc_small (bin_num=5, heap=0x7f7b02800040) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:1313 1313 heap->free_slot[bin_num] = p->next_free_slot; (gdb) bt #0 zend_mm_alloc_small (bin_num=5, heap=0x7f7b02800040) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:1313 #1 zend_mm_alloc_heap (size=<optimized out>, heap=0x7f7b02800040) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:1384 #2 _emalloc (size=<optimized out>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:2601 #3 0x00005589013d057a in zend_string_alloc (persistent=false, len=20) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_string.h:152 #4 zend_string_init (persistent=false, len=20, str=0x7f7aea3da3ce "HTTP_PARTIAL_CONTENT = 206;\n public const HTTP_MULTI_STATUS = 207; // RFC4918\n public const HTTP_ALREADY_REPORTED = 208; // RFC5842\n public const HTTP_IM_USED = 226;", ' ' <repeats 12 times>...) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_string.h:174 #5 lex_scan (zendlval=zendlval@entry=0x7fff3a293740, elem=0x7fff3a2937d8) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:9818 #6 0x00005589013e72a0 in zendlex (elem=elem@entry=0x7fff3a2937d8) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_compile.c:1802 #7 0x00005589013c7883 in zendparse () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_parser.c:4758 #8 0x00005589013ca656 in zend_compile (type=type@entry=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:601 #9 0x00005589013cbdff in compile_file (file_handle=0x7fff3a294460, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:655 #10 0x00007f7aec7df256 in phar_compile_file (file_handle=0x7fff3a294460, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/ext/phar/phar.c:3355 #11 0x00005589013cbec1 in compile_filename (type=type@entry=2, filename=filename@entry=0x7f7aea383770) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:706 #12 0x0000558901441f8f in zend_include_or_eval (inc_filename_zv=<optimized out>, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute.c:4799 #13 0x0000558901450f6f in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:38960 #14 0x0000558901479886 in execute_ex (ex=0xe34128) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:59407 #15 0x00005589013fdbf8 in zend_call_function (fci=fci@entry=0x7fff3a2947a0, fci_cache=<optimized out>, fci_cache@entry=0x7fff3a294780) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:949 #16 0x00005589013fdf87 in zend_call_known_function (fn=0x7f7b02991498, object=<optimized out>, called_scope=<optimized out>, retval_ptr=retval_ptr@entry=0x0, param_count=param_count@entry=1, params=params@entry=0x7fff3a294830, named_params=0x0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1043 #17 0x00005589012fba15 in spl_perform_autoload (class_name=0x7f7b02902b90, lc_name=0x7f7b029035a0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/ext/spl/php_spl.c:445 #18 0x00005589013fcd77 in zend_lookup_class_ex (name=name@entry=0x7f7b02902b90, key=0x7f7b029035a0, flags=flags@entry=512) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1209 #19 0x00005589013fe3ea in zend_fetch_class_by_name (class_name=0x7f7b02902b90, key=<optimized out>, fetch_type=fetch_type@entry=512) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1705 #20 0x000055890144dbb7 in ZEND_NEW_SPEC_CONST_UNUSED_HANDLER () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:10277 #21 0x0000558901478190 in execute_ex (ex=0xe34128) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:56949 #22 0x0000558901481e11 in zend_execute (op_array=0x7f7b02801100, return_value=<optimized out>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:60408 #23 0x000055890140cdeb in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend.c:1833 #24 0x00005589013a3bda in php_execute_script (primary_file=primary_file@entry=0x7fff3a296db0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/main/main.c:2542 #25 0x0000558901500e64 in php_cli_server_dispatch_script (server=server@entry=0x558901a0e120 <server>, client=client@entry=0x558902f18ab0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli_server.c:2097 --Type <RET> for more, q to quit, c to continue without paging-- #26 0x00005589015014b4 in php_cli_server_dispatch (client=0x558902f18ab0, server=0x558901a0e120 <server>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli_server.c:2278 #27 php_cli_server_recv_event_read_request (server=0x558901a0e120 <server>, client=0x558902f18ab0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli_server.c:2586 #28 0x00005589014fea86 in php_cli_server_do_event_for_each_fd_callback (_params=_params@entry=0x7fff3a297080, fd=fd@entry=4, event=event@entry=1) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli_server.c:2673 #29 0x0000558901502a2d in php_cli_server_poller_iter_on_active (poller=0x558901a0e128 <server+8>, callback=0x5589014fea30 <php_cli_server_do_event_for_each_fd_callback>, opaque=0x7fff3a297080) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli_server.c:909 #30 php_cli_server_do_event_for_each_fd (whandler=0x558901501d70 <php_cli_server_send_event>, rhandler=0x558901500e70 <php_cli_server_recv_event_read_request>, server=0x558901a0e120 <server>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli_server.c:2693 #31 php_cli_server_do_event_loop (server=0x558901a0e120 <server>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli_server.c:2704 #32 do_cli_server (argc=argc@entry=6, argv=argv@entry=0x558902ce9c10) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli_server.c:2835 #33 0x000055890124126e in main (argc=6, argv=0x558902ce9c10) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli.c:1336 ``` I also produced the following zbacktrace: ``` (gdb) source .gdbinit (gdb) zbacktrace [0x7f7b02813ff0] Symfony\Component\ErrorHandler\DebugClassLoader->loadClass("Symfony\Component\HttpFoundation\Respons e") /home/u1/code/test2/vendor/symfony/error-handler/DebugClassLoader.php:296 [0x7f7b02813e10] App\Controller\TestController->index() /home/u1/code/test2/src/Controller/TestController.php:30 [0x7f7b02813950] Symfony\Component\HttpKernel\HttpKernel->handleRaw(object[0x7f7b028139a0], 1) /home/u1/code/test2/vendor/symfony/http-kernel/HttpKernel.php:182 [0x7f7b028136a0] Symfony\Component\HttpKernel\HttpKernel->handle(object[0x7f7b028136f0], 1, true) /home/u1/code/test2/vendor/symfony/http-kernel/HttpKernel.php:76 [0x7f7b02813510] Symfony\Component\HttpKernel\Kernel->handle(object[0x7f7b02813560]) /home/u1/code/test2/vendor/symfony/http-kernel/Kernel.php:197 [0x7f7b02813410] Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() /home/u1/code/test2/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35 [0x7f7b028130b0] (main) /home/u1/code/test2/vendor/autoload_runtime.php:29 [0x7f7b02813020] (main) /home/u1/code/test2/public/index.php:5 ``` I also tried to execute the same code in PHPUnit 9.6.10. It produced the almost identical backtrace: ``` 1313 heap->free_slot[bin_num] = p->next_free_slot; #0 zend_mm_alloc_small (bin_num=5, heap=0x7ffff7200040) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:1313 #1 zend_mm_alloc_heap (size=<optimized out>, heap=0x7ffff7200040) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:1384 #2 _emalloc (size=<optimized out>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:2601 #3 0x00005555557d057a in zend_string_alloc (persistent=false, len=17) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_string.h:152 #4 zend_string_init (persistent=false, len=17, str=0x7fffe0413546 "customComparators as $comparator) {\n", ' ' <repeats 12 times>, "if ($comparator->accepts($expected, $actual)) {\n", ' ' <repeats 16 times>, "return $comparator;\n", ' ' <repeats 12 times>, "}\n }\n\n foreach ($this->defaultComparators "...) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_string.h:174 #5 lex_scan (zendlval=zendlval@entry=0x7fffffff9310, elem=0x7fffffff93a8) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:9818 #6 0x00005555557e72a0 in zendlex (elem=elem@entry=0x7fffffff93a8) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_compile.c:1802 #7 0x00005555557c7883 in zendparse () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_parser.c:4758 #8 0x00005555557ca656 in zend_compile (type=type@entry=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:601 #9 0x00005555557cbdff in compile_file (file_handle=0x7fffffffa030, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:655 #10 0x00007fffe32b9256 in phar_compile_file (file_handle=0x7fffffffa030, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/ext/phar/phar.c:3355 #11 0x00005555557cbec1 in compile_filename (type=type@entry=2, filename=filename@entry=0x7ffff7322bd0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:706 #12 0x0000555555841f8f in zend_include_or_eval (inc_filename_zv=<optimized out>, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute.c:4799 #13 0x0000555555850f6f in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:38960 #14 0x0000555555879886 in execute_ex (ex=0xa48938) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:59407 #15 0x00005555557fdbf8 in zend_call_function (fci=fci@entry=0x7fffffffa370, fci_cache=<optimized out>, fci_cache@entry=0x7fffffffa350) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:949 #16 0x00005555557fdf87 in zend_call_known_function (fn=0x7fffe09a0d38, object=<optimized out>, called_scope=<optimized out>, retval_ptr=retval_ptr@entry=0x0, param_count=param_count@entry=1, params=params@entry=0x7fffffffa400, named_params=0x0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1043 #17 0x00005555556fba15 in spl_perform_autoload (class_name=0x7fffe0d94b40, lc_name=0x7fffe0a0da80) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/ext/spl/php_spl.c:445 #18 0x00005555557fcd77 in zend_lookup_class_ex (name=name@entry=0x7fffe0d94b40, key=0x7fffe0a0da80, flags=flags@entry=512) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1209 #19 0x00005555557fe3ea in zend_fetch_class_by_name (class_name=0x7fffe0d94b40, key=<optimized out>, fetch_type=fetch_type@entry=512) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1705 #20 0x000055555584e5e7 in ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:6886 #21 0x0000555555877f5d in execute_ex (ex=0xa48938) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:56641 #22 0x0000555555881e11 in zend_execute (op_array=0x7ffff7291000, return_value=<optimized out>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:60408 #23 0x000055555580cdeb in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend.c:1833 #24 0x00005555557a3bda in php_execute_script (primary_file=primary_file@entry=0x7fffffffcaf0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/main/main.c:2542 #25 0x00005555558f9e7b in do_cli (argc=4, argv=0x555555e10680) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli.c:964 #26 0x00005555556413a9 in main (argc=4, argv=0x555555e10680) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli.c:1333 ``` And the PHPUnit zbacktrace ``` [0x7ffff721a700] Symfony\Component\ErrorHandler\DebugClassLoader->loadClass("SebastianBergmann\Comparator\Factory") /home/u1/code/php/test1/vendor/symfony/error-handler/DebugClassLoader.php:294 [0x7ffff721a630] PHPUnit\Framework\TestCase->unregisterCustomComparators() /home/u1/code/php/test1/vendor/phpunit/phpunit/src/Framework/TestCase.php:2551 [0x7ffff7219e90] PHPUnit\Framework\TestCase->runBare() /home/u1/code/php/test1/vendor/phpunit/phpunit/src/Framework/TestCase.php:1291 [0x7ffff7218c90] PHPUnit\Framework\TestResult->run(object[0x7ffff7218ce0]) /home/u1/code/php/test1/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 [0x7ffff7218080] PHPUnit\Framework\TestCase->run(object[0x7ffff72180d0]) /home/u1/code/php/test1/vendor/phpunit/phpunit/src/Framework/TestCase.php:964 [0x7ffff7217980] PHPUnit\Framework\TestSuite->run(object[0x7ffff72179d0]) /home/u1/code/php/test1/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684 [0x7ffff7217280] PHPUnit\Framework\TestSuite->run(object[0x7ffff72172d0]) /home/u1/code/php/test1/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684 [0x7ffff7216b80] PHPUnit\Framework\TestSuite->run(object[0x7ffff7216bd0]) /home/u1/code/php/test1/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684 [0x7ffff7214840] PHPUnit\TextUI\TestRunner->run(object[0x7ffff7214890], reference, reference, true) /home/u1/code/php/test1/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651 [0x7ffff7214470] PHPUnit\TextUI\Command->run(array(3)[0x7ffff72144c0], true) /home/u1/code/php/test1/vendor/phpunit/phpunit/src/TextUI/Command.php:144 [0x7ffff7214360] PHPUnit\TextUI\Command->main() /home/u1/code/php/test1/vendor/phpunit/phpunit/src/TextUI/Command.php:97 [0x7ffff7214020] (main) /home/u1/code/php/test1/vendor/phpunit/phpunit/phpunit:107 ``` I am not knowledgeable of PHP's internals, but from the two faillings examples it appears that the issue is present when a PHP method 'loadClass' is called. This causes _spl_perform_autoload_ to run to load a class and to fail deeper in the stack. # Simple test case to reproduce Following that, I changed my simple test to: ```php <?php require_once __DIR__ . '/vendor/autoload.php'; $processor = new \Saxon\SaxonProcessor(); $input = file_get_contents(__DIR__.'/input.xml'); $xdmDoc = $processor->parseXmlFromString($input); $processor = $processor->newXslt30Processor(); $compiled = $processor->compileFromString( file_get_contents(__DIR__.'/template.xslt') ); $args = []; $result = $compiled->transformToString($xdmDoc); // Crashes here. $response = new \Symfony\Component\HttpFoundation\Response(); echo $result; echo var_dump($response); ``` With the following backtrace: ``` (gdb) bt #0 zend_mm_alloc_small (bin_num=5, heap=0x7ffff7200040) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:1313 #1 zend_mm_alloc_heap (size=<optimized out>, heap=0x7ffff7200040) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:1384 #2 _emalloc (size=<optimized out>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_alloc.c:2601 #3 0x00005555557d057a in zend_string_alloc (persistent=false, len=20) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_string.h:152 #4 zend_string_init (persistent=false, len=20, str=0x7ffff73413ce "HTTP_PARTIAL_CONTENT = 206;\n public const HTTP_MULTI_STATUS = 207; // RFC4918\n public const HTTP_ALREADY_REPORTED = 208; // RFC5842\n public const HTTP_IM_USED = 226;", ' ' <repeats 12 times>...) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_string.h:174 #5 lex_scan (zendlval=zendlval@entry=0x7fffffff9160, elem=0x7fffffff91f8) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:9818 #6 0x00005555557e72a0 in zendlex (elem=elem@entry=0x7fffffff91f8) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_compile.c:1802 #7 0x00005555557c7883 in zendparse () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_parser.c:4758 #8 0x00005555557ca656 in zend_compile (type=type@entry=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:601 #9 0x00005555557cbdff in compile_file (file_handle=0x7fffffff9e80, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:655 #10 0x00007fffe32b9256 in phar_compile_file (file_handle=0x7fffffff9e80, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/ext/phar/phar.c:3355 #11 0x00005555557cbec1 in compile_filename (type=type@entry=2, filename=filename@entry=0x7ffff7255150) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_language_scanner.c:706 #12 0x0000555555841f8f in zend_include_or_eval (inc_filename_zv=<optimized out>, type=2) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute.c:4799 #13 0x0000555555850f6f in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:38960 #14 0x0000555555879886 in execute_ex (ex=0x193600) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:59407 --Type <RET> for more, q to quit, c to continue without paging-- #15 0x00005555557fdbf8 in zend_call_function (fci=fci@entry=0x7fffffffa1c0, fci_cache=<optimized out>, fci_cache@entry=0x7fffffffa1a0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:949 #16 0x00005555557fdf87 in zend_call_known_function (fn=0x7ffff7204cd8, object=<optimized out>, called_scope=<optimized out>, retval_ptr=retval_ptr@entry=0x0, param_count=param_count@entry=1, params=params@entry=0x7fffffffa250, named_params=0x0) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1043 #17 0x00005555556fba15 in spl_perform_autoload (class_name=0x7ffff727b0f0, lc_name=0x7ffff727b190) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/ext/spl/php_spl.c:445 #18 0x00005555557fcd77 in zend_lookup_class_ex (name=name@entry=0x7ffff727b0f0, key=0x7ffff727b190, flags=flags@entry=512) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1209 #19 0x00005555557fe3ea in zend_fetch_class_by_name (class_name=0x7ffff727b0f0, key=<optimized out>, fetch_type=fetch_type@entry=512) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_execute_API.c:1705 #20 0x000055555584dbb7 in ZEND_NEW_SPEC_CONST_UNUSED_HANDLER () at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:10277 #21 0x0000555555878190 in execute_ex (ex=0x193600) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:56949 #22 0x0000555555881e11 in zend_execute (op_array=0x7ffff7290000, return_value=<optimized out>) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend_vm_execute.h:60408 #23 0x000055555580cdeb in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/Zend/zend.c:1833 #24 0x00005555557a3bda in php_execute_script (primary_file=primary_file@entry=0x7fffffffc940) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/main/main.c:2542 #25 0x00005555558f9e7b in do_cli (argc=2, argv=0x555555e10900) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli.c:964 #26 0x00005555556413a9 in main (argc=2, argv=0x555555e10900) at /usr/src/debug/php-8.2.10-1.fc38.x86_64/sapi/cli/php_cli.c:1333 ``` And this short zbacktrace: ``` (gdb) zbacktrace [0x7ffff72132c0] Composer\Autoload\includeFile("/home/u1/code/test2/vendor/composer/../symfony/http-foundation/Response.php") /home/u1/code/test2/vendor/composer/ClassLoader.php:571 [0x7ffff7213220] Composer\Autoload\ClassLoader->loadClass("Symfony\Component\HttpFoundation\Response") /home/u1/code/test2/vendor/composer/ClassLoader.php:428 [0x7ffff7213020] (main) /home/u1/code/test2/simple_test_ko.php:17 ``` So, I can confirm that using the autoloader after using the extension causes the crash. Now, I am not sure what to do: * Is it a bug in PHP's core that is triggered by this extension? * Is it a bug in the extension, which does something wrong, and is only noticed later. If so, I guess I should contact the upstream developers of the extension? * Something else I missed? # How to install the extension * You can install the PHP extension for Saxon from the package I built on Copr for Fedora 38 there: http://tinyurl.com/5n8v9jyz * The Saxonica's C PHP extension sources: https://saxonica.com/download/libsaxon-HEC-linux-x86_64-v12.3.zip. * The RPM spec file source: https://gitlab.com/saxon-packaging/saxon-package/-/tree/php/saxonphp?ref_type=heads How to build the RPM on Fedora 38: ``` sudo dnf install fedora-packager fedora-review git clone git@gitlab.com:saxon-packaging/saxon-package.git saxon-package cd saxon-package git checkout php cd saxonphp fedpkg --release f38 mockbuild --enable-network ``` Then look in _results_php-saxon_. ### PHP Version PHP 8.2.10 ### Operating System Fedora 38 x64-64

« previous php.bugs (#245330) next »