[ZBX-6695] Harmonize use of require_once and include_once for footer.php Created: 2013 Jun 12  Updated: 2017 May 30  Resolved: 2013 Jun 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.7, 2.1.0
Fix Version/s: 2.1.0

Type: Incident report Priority: Trivial
Reporter: Volker Fröhlich Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: consistency, internals, style
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

require_once and include_once are mixedly used to include the footer snippet:

require_once 'include/page_footer.php';
include_once('include/page_footer.php');

Furthermore, dirname(_FILE_) is only prepended in some occasions.



 Comments   
Comment by richlv [ 2013 Jun 12 ]

(1) services.php seems to include footer twice conditionally, and once unconditionally.
is there a reason for that ?

iivs removed duplicate footer include entries
RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-6695

<richlv> CLOSED

Comment by richlv [ 2013 Jun 12 ]

https://www.zabbix.org/wiki/Docs/specs/coding_style#Statement_formatting is relevant here

Comment by richlv [ 2013 Jun 12 ]

include_once usage :

./srv_status.php:include_once('include/page_footer.php');
./chart5.php:include_once('include/page_footer.php');
./services.php: include_once('include/page_footer.php');
./services.php: include_once('include/page_footer.php');
./services.php:include_once('include/page_footer.php');
./srv_status.php:include_once('include/page_header.php');
./chart5.php:include_once('include/page_header.php');
./services.php:include_once('include/page_header.php');

require_once without dirname(_FILE_) :

./popup_bitem.php:require_once 'include/page_footer.php';
./popup_period.php:require_once 'include/page_footer.php';
./authentication.php:require_once 'include/page_footer.php';
./scripts_exec.php:require_once 'include/page_footer.php';
./latest.php:require_once 'include/page_footer.php';
./image.php:require_once 'include/page_footer.php';
./conf.import.php:require_once('include/page_footer.php');
./popup_bitem.php:require_once 'include/page_header.php';
./popup_period.php:require_once 'include/page_header.php';
./chart6.php:require_once 'include/page_header.php';
./tr_events.php:require_once 'include/page_header.php';
./queue.php:require_once 'include/page_header.php';
./scripts_exec.php:require_once ('include/page_header.php');
./conf.import.php:require_once 'include/page_header.php';

Comment by Ivo Kurzemnieks [ 2013 Jun 17 ]
  • changed include_once to require_once
  • added dirname(_FILE_)
  • ommited closing ?> tags after footer is included
  • removed unnecessary closing and opening ?><?php tags
    RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-6695
Comment by richlv [ 2013 Jun 17 ]

(2) scripts_exec.php seems to have excess parenthesis :
require_once ('include/page_header.php');

<richlv> checked wrong branch, CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2013 Jun 18 ]

TESTED.

Comment by Ivo Kurzemnieks [ 2013 Jun 18 ]

Fixed in pre-2.1.0 (trunk) r36428

Generated at Sat Apr 20 19:15:42 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.