View Issue Details

IDProjectCategoryView StatusLast Update
0012249mantisbthtmlpublic2011-08-02 12:35
Reportermark_k2 Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Versiongit trunk 
Target Version1.2.3Fixed in Version1.2.3 
Summary0012249: g_error_send_page_header condition check always evaluates to true
Description

In 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.

Activities

dhx

dhx

2010-08-12 09:10

reporter   ~0026295

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

Related Changesets

MantisBT: master e71dfde5

2010-08-12 09:03

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).
Affected Issues
0012249
mod - core/error_api.php Diff File

MantisBT: master-1.2.x afd5c450

2010-08-12 09:03

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).
Affected Issues
0012249
mod - core/error_api.php Diff File