From:             
Operating system: CentOS 4
PHP version:      5.3.6
Package:          SOAP related
Bug Type:         Bug
Bug description:soap_version logic bug

Description:
------------
This code in soap.c:



if (zend_hash_find(ht, "soap_version", sizeof("soap_version"),
(void**)&tmp) == SUCCESS) {

  if (Z_TYPE_PP(tmp) == IS_LONG ||

    (Z_LVAL_PP(tmp) == SOAP_1_1 && Z_LVAL_PP(tmp) == SOAP_1_2)) {

      version = Z_LVAL_PP(tmp);

  }

}



has a problem with the second line of the inner if statement. 
Z_LVAL_PP(tmp) can't be both equal to SOAP_1_1 and SOAP_1_2, so this part
will always be false.



Plus, the "||" logic seems wrong too.  It appears that if the type is
IS_LONG, then any value is accepted.  



Patch is attached.



It looks like the logic is inverted.  || should && and && should be ||:



if (zend_hash_find(ht, "soap_version", sizeof("soap_version"),
(void**)&tmp) == SUCCESS) {

  if (Z_TYPE_PP(tmp) == IS_LONG &&

    (Z_LVAL_PP(tmp) == SOAP_1_1 || Z_LVAL_PP(tmp) == SOAP_1_2)) {

      version = Z_LVAL_PP(tmp);

  }

}




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

Reply via email to