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

Test script:
var_dump(sqlite_error_string( 127 ) );

Expected result:

Actual result:
string(13) "unknown error"


Add a Patch

Pull Requests

Add a Pull Request


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

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

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 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Aug 03 13:01:23 2021 UTC