Issue: https://github.com/php/php-src/issues/10430
Author: pfrappe
### Description
Sorry this problem appears within a big application and I didn't find a short php code
reproducing the problem.
So I try to put the maximum explanations here.
In some cases I get this message in error log :+1:
[core:notice] [pid 910] AH00051: child pid 23361 exit signal Segmentation fault (11), possible
coredump in /etc/apache2
I found this message always appears twice because, when I get it, the index.php is done a second
time. To find that, I put an errog_log('deb') at the very beginning of the index.php and
an error_log('fin') at the last instruction.
in the log, I got :
[Tue Jan 24 10:50:37.515447 2023] [php:notice] [pid 23488] [client 127.0.0.1:49088] deb, referer: http://localhost/wer/index.php
[Tue Jan 24 10:50:40.193277 2023] [php:notice] [pid 23488] [client 127.0.0.1:49088] fin, referer: http://localhost/wer/index.php
[Tue Jan 24 10:50:40.856392 2023] [php:notice] [pid 23835] [client 127.0.0.1:49102] deb, referer: http://localhost/wer/index.php
[Tue Jan 24 10:50:41.479629 2023] [core:notice] [pid 910] AH00051: child pid 23488 exit signal
Segmentation fault (11), possible coredump in /etc/apache2
[Tue Jan 24 10:50:43.102831 2023] [php:notice] [pid 23835] [client 127.0.0.1:49102] fin, referer: http://localhost/wer/index.php
[Tue Jan 24 10:50:43.482049 2023] [core:notice] [pid 910] AH00051: child pid 23835 exit signal
Segmentation fault (11), possible coredump in /etc/apache2
So, index.php seems to be executed twice. But nothing is sent to the navigator.
However, if I print the expected HTML result in the log, it is totally correct. (and I get it
twice...)
Step by step, I found it could appear after the creation of an object because the problem disappears
when I put a print_r of that object :
This causes the problem
$ret = SG_Operation::execFonctionSansParametre($this, $o, $nom, $p2, $p1, $contexte);
//print_r($ret, true);
An this work normally...
$ret = SG_Operation::execFonctionSansParametre($this, $o, $nom, $p2, $p1, $contexte);
print_r($ret, true);
The expected $ret is an php object and var_dump($ret) sends something totally correct for me (even
when it bugs) :
SG_Nombre Object
(
[typeSG] => @Nombre
[reference] =>
[index] => ecriture/049b4ca98d6ce9212ef3590d4541e016/slde
[titre] =>
[id] =>
[proprietes] => Array
(
)
[contenant] => Ecriture Object
(
[typeSG] => Ecriture
[reference] =>
[index] =>
[titre] =>
[id] =>
[proprietes] => Array
(
[@Cle] => 20220530
[slde] => SG_Nombre Object
*RECURSION*
)
[contenant] =>
[erreur] =>
[icone] =>
[numero] => 5
[style:SG_Objet:private] => Array
(
)
[contextes] =>
[doc] => SG_DocumentCouchDB Object
(
[typeSG] => @DocumentCouchDB
[reference] =>
[index] =>
[titre] =>
[id] =>
[proprietes] => Array
(
[_rev] => 3-daa9fdf4dd7d5637583e8521c753d184
[@Type] => Ecriture
[Date] => 30/05/2022
[CompteDebit] => Caisse
[Mode] => Esp\xc3\xa8ces
[NoPiece] => voir signature
[Motif] => H\xc3\xa9bergement
[Qui] => contact/3fbc0350035eb64c6e0d037cf8de0d9f
[Montant] => 150
[Titre] => texte texte texte texte
[@DateModification] => 31/05/2022 16:50
[@DateCreation] => 31/05/2022 16:41
[@AuteurModification] => patvan
[@AuteurCreation] => patvan
[DatePointageDebit] => 31/05/2022
)
[contenant] =>
[erreur] =>
[icone] =>
[numero] =>
[style:SG_Objet:private] => Array
(
)
[contextes] =>
[codeBase] => ecriture
[codeBaseComplet] => wer_ecriture
[codeDocument] => 049b4ca98d6ce9212ef3590d4541e016
[revision] => 3-daa9fdf4dd7d5637583e8521c753d184
[stub] =>
[modif] =>
)
[code] =>
[titres] =>
[operation] =>
)
[erreur] =>
[icone] =>
[numero] =>
[style:SG_Objet:private] => Array
(
)
[contextes] =>
[valeur] => -100
[unite] =>
)
But the problem remains.
Please, notice that the expected result is the [slde] which is in RECURSION. But I have that very
often as I put some back reference within my objects.
On the contrary, when I just add an instruction print_r($ret,true). However print_r($ret) is not
enough to solve the problem...
So I guess, the compute create some wrong object and it is corrected by the print_r even if I do
nothing special on that object.
I tried some features which does'nt work :
$obj = SG_Operation::execFonctionSansParametre($this, $o, $nom, $p2, $p1, $contexte);
$ret = $obj;
or
$obj = SG_Operation::execFonctionSansParametre($this, $o, $nom, $p2, $p1, $contexte);
$ret = clone $obj;
PHP 8.1.2-1ubuntu2.10 (cli) (built: Jan 16 2023 15:19:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.10, Copyright (c), by Zend Technologies
on Ubuntu 22.04.1 LTS
I hope I'm clear enough clear...
Pierre Frappé (France)
### PHP Version
PHP 8.1.2
### Operating System
Ubuntu 22.04.1 LTS