From:             
Operating system: All
PHP version:      5.3.2
Package:          PDO related
Bug Type:         Bug
Bug description:A non well formed numeric value encountered

Description:
------------
PDOException extends RuntimeException which in turn extends Exception. The


Exception class has the following constructor:



public __construct ([ string $message = "" [, int $code = 0 [, Exception 

$previous = NULL ]]] )



The $code parameter is to be of type integer. However, when using pdo_odbc
or 

pdo_dblib, the error code returned by the server may be a string, rather
than an 

integer. So, for example, calling $e->getCode() may yield a value of
"12X34". 

This is inconsistent with the method definition as well:



final public int getCode ( void )



PHP's own internal library should not produce outcomes that are in conflict
with 

PHP's definitions.

Test script:
---------------
try

{

    $pdo->query( 'BAD QUERY' );

}

catch ( PDOException $e )

{

    throw new Exception( $e->getMessage(), $e->getCode() );

}

Expected result:
----------------
// Just a thrown exception, nothing important

Actual result:
--------------
PHP Notice:  A non well formed numeric value encountered in [...] on line 7

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

Reply via email to