8 Dec 2024, 9:19 AM
Totally Zenned
- Join Date:
- Jun 2007
- Location:
- Bronx, New York, United States
- Posts:
- 949
- Plugin Contributions:
- 3
admin/banner_manager.php - Error message after deleting last banner
PHP 8, ZC 210
After deleting all existing banners in the banner manager, everything is all and well, right? Sort. Leaving the page after the last banner is deleted, yields the following warning:
[08-Dec-2024 03:52:18 America/New_York] Request URI: /justuptown/justoffice/index.php?cmd=banner_manager, IP address: 127.0.0.1, Language id 1
#0 E:\xampp\htdocs\justuptown\justoffice\banner_manager.php(606): zen_debug_error_handler()
#1 E:\xampp\htdocs\justuptown\justoffice\index.php(16): require('E:\\xampp\\htdocs...')
--> PHP Warning: Undefined variable $bInfo in E:\xampp\htdocs\justuptown\justoffice\banner_manager.php on line 606.
Generally, after the last banner is removed and as a part of the default condition of the switch ($action), the if statement tries to pull up the info of the "selected" banner. There is none however and thus the error is generated.
Looking at the line of code being referenced in the error, gives this:
if (is_object($bInfo)) {
Changing this line to:
if (isset($bInfo) && is_object($bInfo)) {
Should remove the warning. Submitted as a PR.