php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51999 Code within sqlite_error_string cannot be reached
Submitted: 2010-06-05 14:59 UTC Modified: 2010-06-05 21:20 UTC
From: martin dot dekeijzer at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.3SVN-2010-06-05 (SVN) OS: Linux / Debian
Private report: No CVE-ID: None
 [2010-06-05 14:59 UTC] martin dot dekeijzer at gmail dot com
Description:
------------
When writing phpt tests I was trying to reach a part of the code where the result 
of sqlite_error_string would not return a message.

When passing 127 as an argument to sqlite_error_string I still get a message 
returned though. So this part of the code seems unreachable.

Looking in the function declaration of the extension source the default value for 
error codes is the "Unknown error" message, which also confirms what I already 
assumed. 

Test script:
---------------
var_dump(sqlite_error_string( 127 ) );


Expected result:
----------------
NULL

Actual result:
--------------
string(13) "unknown error"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-05 15:47 UTC] felipe@php.net
-Package: SQLite related +Package: Documentation problem
 [2010-06-05 16:05 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-06-05 16:05 UTC] johannes@php.net
If I get you right you ask for removing the else clause from

if (msg) {
 	RETURN_STRING((char*)msg, 1);
} else {
 	RETURN_NULL();
} 

As it will never be hit. This won't be removed as we have no way to guarantee this will be the always be the case, under all circumstances with all SQLite versions.
 [2010-06-05 21:20 UTC] martin dot dekeijzer at gmail dot com
Ok but the function declaration has a value (default) for all unspecified 
integers
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 08:01:28 2024 UTC