Wrong line & file on error trace
Personne n'a encore pris cette issue.
- Langage dominant
- C
- Étoiles
- 40.4k
- Forks
- 8.2k
- Merge moyen
- 2 j 13 h
- PR mergées (30 j)
- 96
Description
Description
definitions.php
<?php
class ThrowableParam {
public function __construct() {
// this will be line #7 for definitions.php:
throw new Exception(sprintf('I expect to indicate file %s on line %s but it throws', basename(__FILE__), __LINE__));
}
}
trait TraitInASeparateFile {
// but this will be line #16 for definitions.php:
public function execute(ThrowableParam $param=new ThrowableParam): void {}
}
?>
main.php
<?php
include './definitions.php';
class Foo {
use TraitInASeparateFile;
}
$bar=new Foo;
$bar->execute(); // line #11 for main.php
// So, there is no line #16 for main.php
?>
RESULT :
Fatal error: Uncaught Exception: I expect to indicate file definitions.php on line 7 but it throws in ./main.php:16
Stack trace:
#0 ./definitions.php(7): constant expression
#1 ./definitions.php(16): ThrowableParam->__construct()
#2 ./main/php(11): Foo->execute()
#3 {main}
thrown in /var/www/html/nbcloud/_tests/bugPHP.php on line 16
BUT EXPECT :
Fatal error: Uncaught Exception: I expect to indicate file definitions.php on line 7 but it throws in ./definitions.php:7
Stack trace:
#0 ./definitions.php(7): constant expression
#1 ./definitions.php(16): ThrowableParam->__construct()
#2 ./main/php(11): Foo->execute()
#3 {main}
thrown in /var/www/html/nbcloud/_tests/bugPHP.php on line 16
PHP Version
8.4.5
Operating System
Debian 11
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par reproduire le rapport avec definitions.php et main.php sous PHP 8.4.5, en comparant l'emplacement du lancement avec la trace de la pile. Examinez la gestion à l'exécution de l'argument par défaut du constructeur sous forme d'expression constante et vérifiez que l'emplacement du lancement indiqué est definitions.php:7 plutôt que main.php:16.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- php
- Domaine
- backend
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100