|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42584 mssql functions trigger errors twice
Submitted: 2007-09-07 08:17 UTC Modified: 2008-10-12 01:00 UTC
Avg. Score:4.3 ± 1.4
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: miracle dot rpz at gmail dot com Assigned:
Status: No Feedback Package: MSSQL related
PHP Version: 5.2.4 OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-09-07 08:17 UTC] miracle dot rpz at gmail dot com
mssql_functions trigger errors twice.
It causes program hang-up if error_handler contains exit-functions

Reproduce code:
function error_handler() {
    print ('Hello World'.PHP_EOL);
mssql_select_db('NONEXISTEN');  #or any mssql_* func

Expected result:
Hello World

Actual result:
Hello World
Hello World


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-07 11:05 UTC]
Are you running the script on command line? (as there it's perfectly normal to get all errors twice..)
 [2007-09-07 11:48 UTC] miracle dot rpz at gmail dot com
Yes, this actual result from cli. Throw mod_php this code output "hello" three times, but fopen('nonexisten.file','r'); #trigger error handler only once.

    function error_handler() {
       die ('Hello World'.PHP_EOL);
    mssql_connect('correct','mssql','dsn'); #connect successfull
    mssql_select_db('NONEXISTEN'); # trigger_error

after output 'Hello world' - program hung-up (mod_php & cli)
 [2008-10-04 03:46 UTC]
This is bogus, because mssql_select_db() throws two warnings:

1) Because it cannot connect
2) Function cannot be used because no link has been made to a server

Change the error_handler() function to this and it will expose it:
function error_handler($errno, $error)
	echo $error, PHP_EOL;

mssql_select_db(): Unable to connect to server: (null)
mssql_select_db(): A link to the server could not be established
 [2008-10-04 07:58 UTC] miracle dot rpz at gmail dot com
Please read my previous comment. Read it again. Link to server exists!
 [2008-10-04 13:25 UTC]
Please try using this CVS snapshot:
For Windows (zip):

For Windows (installer):

Using a latest 5.2 version, what error message you get when using:


function error_handler($errno, $error) {


 [2008-10-04 16:00 UTC] miracle dot rpz at gmail dot com
string(184) "mssql_select_db(): message: Could not locate entry in sysdatabases for database 'NONEXISTEN'. No entry found with that name. Make sure that the name is entered correctly. (severity 16)"

On *nix (with FreeTDS) after this message program exit. On Windows - hang up. Without 'die' i have second message:

string(57) "mssql_select_db(): Unable to select database:  NONEXISTEN"
 [2008-10-12 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Feb 27 21:01:27 2024 UTC