MantisBT

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012249mantisbthtmlpublic2010-08-11 14:382011-08-02 12:35
Reportermark_k2 
Assigned Todhx 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Versiongit trunk 
Target Version1.2.3Fixed in Version1.2.3 
Summary0012249: g_error_send_page_header condition check always evaluates to true
DescriptionIn core/error_api.php around line 166



 function error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) {
                        }

                        # don't send the page header information if it has already been sent
                       if( $g_error_send_page_header || $g_error_send_page_header == null ) {
                                if( $t_html_api ) {
                                        html_page_top1();
                                        if( $p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true ) {


The condition check of $g_error_send_page_header always evaluates to true because any non 0, non negative number will trigger the first part of the if statement, and any 0, null, empty string, or negative number will trigger the second check.

I think the second check should use three equal signs when checking against null.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
User avatar (0026295)
dhx (developer)
2010-08-12 09:10

Thanks Mark, I've committed a fix ready for the next release.

- Related Changesets
MantisBT: master e71dfde5
Timestamp: 2010-08-12 13:03:54
Author: dhx
Details ] Diff ]
Fix 0012249: g_error_send_page_header condition check always true

Within the error_handler() function of error_api.php, this check was
being performed:

if( $g_error_send_page_header || $g_error_send_page_header == null )

Due to PHP's handling of boolean logic this check would always be
validated as true. To solve this problem we simplify the evaluation by
removing the possibility that the variable can be null (we set it to
true by default now).
mod - core/error_api.php Diff ] File ]
MantisBT: master-1.2.x afd5c450
Timestamp: 2010-08-12 13:03:54
Author: dhx
Details ] Diff ]
Fix 0012249: g_error_send_page_header condition check always true

Within the error_handler() function of error_api.php, this check was
being performed:

if( $g_error_send_page_header || $g_error_send_page_header == null )

Due to PHP's handling of boolean logic this check would always be
validated as true. To solve this problem we simplify the evaluation by
removing the possibility that the variable can be null (we set it to
true by default now).
mod - core/error_api.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2010-08-11 14:38 mark_k2 New Issue
2010-08-12 09:03 dhx Assigned To => dhx
2010-08-12 09:03 dhx Status new => assigned
2010-08-12 09:03 dhx Target Version => 1.2.3
2010-08-12 09:09 dhx Changeset attached => MantisBT master e71dfde5
2010-08-12 09:09 dhx Changeset attached => MantisBT master-1.2.x afd5c450
2010-08-12 09:09 dhx Resolution open => fixed
2010-08-12 09:09 dhx Fixed in Version => 1.2.3
2010-08-12 09:10 dhx Note Added: 0026295
2010-08-12 09:10 dhx Status assigned => resolved
2011-08-02 12:35 dregad Status resolved => closed


MantisBT 1.2.16dev master-1.2.x-8c2bd07 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.0806 seconds.
memory usage: 2,791 KB
Powered by Mantis Bugtracker