Req #80123 [Opn->Wfx]: Cannot redeclare does not provide include reference

From: Date: Thu, 19 Aug 2021 21:12:52 +0000
Subject: Req #80123 [Opn->Wfx]: Cannot redeclare does not provide include reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235970@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80123&edit=1 ID: 80123 Updated by: cmb@php.net Reported by: jab_creations at yahoo dot com Summary: Cannot redeclare does not provide include reference -Status: Open +Status: Wont fix Type: Feature/Change Request Package: Unknown/Other Function Operating System: *nix/Win PHP Version: 7.4.10 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This case doesn't appear common enough that it warrants to maintain the include chain for each and every OP array. > Use include_once instead, and don't get an error in the first > place? That. Or maybe better require_once. If you still want to see this, please pursue the RFC process[1]. [1] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2020-09-20 21:23:11] cmb@php.net Use include_once instead, and don't get an error in the first place? Anyhow, I don't think this qualifies as a bug, but is more like a feature request. ------------------------------------------------------------------------ [2020-09-19 22:02:50] jab_creations at yahoo dot com Description: ------------ When I have to debug an error like this: Fatal error: Cannot redeclare session() (previously declared in D:\web\sessions.php:2) ...it does not tell me what file included the file with the session function. That forces me to do pointlessly convoluted debug. I've tried doing back tracing however the error is reported and the process shuts down so I don't get the second back trace. Test script: --------------- An overly simplified version: <?php include('file1.php');//includes session.php. include('file2.php');//includes session.php; error spawns, no second back trace. ?> Expected result: ---------------- A much more useful error message would look something like: Fatal error: Cannot redeclare session() (previously declared in D:\web\sessions.php:2, file included by file1.php, file included by file2.php). ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80123&edit=1

« previous php.bugs (#235970) next »