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

Simplexml parsing with PHP 8.2 and Apache and attribute leads to an segfault #406

Closed
HLeithner opened this issue Mar 4, 2023 · 3 comments
Labels
bug dependencies Pull requests that update a dependency file

Comments

@HLeithner
Copy link

Trying to debug a simplexml object which has an attribute leads to an segfault of php 8.2 SAPI client in apache.
It works for CLI...

Example Script:

<?php

require_once __DIR__ . '/kint.phar';

$xml = <<<XML
<form name="test"></form>
XML;

$simplexml = simplexml_load_string($xml);

kint::dump($simplexml);

Workaround:
adding a type cast to string for the value solves the problem but of course this not the reason for the problem
https://github.com/kint-php/kint/blob/master/src/Parser/SimpleXMLElementPlugin.php#L102

Sadly I wasn't able to debug this in deep.

@jnvsor
Copy link
Member

jnvsor commented Mar 4, 2023

My immediate thought is that this must be a bug in mod-php since the entire thing down to HTML output works in CLI (and the server should never be segfaulting)

I'll debug this a bit further and see if I can't submit a bug report. Thanks!

@jnvsor jnvsor added bug dependencies Pull requests that update a dependency file labels Mar 4, 2023
@jnvsor
Copy link
Member

jnvsor commented Mar 30, 2023

It has stopped working in CLI now, so I presume whatever patch caused it either got worse or wasn't up to date in the CLI package in debian sid.

I've managed to narrow it down to this:

<?php
require 'autoload.php';

$xml = <<<XML
<form name="test"></form>
XML;

$simplexml = simplexml_load_string($xml);

var_dump($simplexml['name']);
$reflector = new ReflectionObject($simplexml['name']);
$rprops = $reflector->getProperties();

Strangely, without the composer autoloader it works fine

Edit: Bug report submitted upstream: php/php-src#10983

I'm going to close this now since it's not a kint bug. Watch that issue for more info

@jnvsor jnvsor closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2023
@HLeithner
Copy link
Author

thanks for your engagement, so it should be fixed with php/php-src#10984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants