From:             
Operating system: Linux
PHP version:      5.3.6
Package:          Unknown/Other Function
Bug Type:         Bug
Bug description:assert.active is not being reset upon request shutdown

Description:
------------
The assert related functions are saving their state in a global structure.
The 

problem is that the assert state is not being reset in the RSHUTDOWN
function 

and thus the assert state of the last request will be used for the next
request.



Example: If assert is active by default (php.ini assert.active) and you set
it 

to false via assert_options this works fine. However on the next request
the 

default will be that assert is not active.





The fix is to add



  ASSERTG(active)=INI_INT("assert.active");



to asserts RSHUTDOWN function.



I am using the FastCGI SAPI.

Test script:
---------------
var_dump(assert_options(ASSERT_ACTIVE));

assert(false);

var_dump(assert_options(ASSERT_ACTIVE,1));

assert(false);

var_dump(assert_options(ASSERT_ACTIVE,0));

assert(false);



Expected result:
----------------
int(1) 

Warning: assert() [function.assert]: Assertion failed in xxx.php on line 3

int(1) 

Warning: assert() [function.assert]: Assertion failed in xxx.php on line 5

int(1)

Actual result:
--------------
First request:



int(1) 

Warning: assert() [function.assert]: Assertion failed in xxx.php on line 3

int(1) 

Warning: assert() [function.assert]: Assertion failed in xxx.php on line 5

int(1)



Second request (make sure you hit the same pid):



int(0) int(0) 

Warning: assert() [function.assert]: Assertion failed in xxx.php on line 5

int(1)



-- 
Edit bug report at http://bugs.php.net/bug.php?id=54924&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54924&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54924&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54924&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54924&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54924&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54924&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54924&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54924&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54924&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54924&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54924&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54924&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54924&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54924&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54924&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54924&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54924&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54924&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54924&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54924&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54924&r=mysqlcfg

Reply via email to