|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-09-07 08:17 UTC] miracle dot rpz at gmail dot com
Description:
------------
mssql_functions trigger errors twice.
It causes program hang-up if error_handler contains exit-functions
Reproduce code:
---------------
<?php
function error_handler() {
print ('Hello World'.PHP_EOL);
}
set_error_handler('error_handler');
mssql_select_db('NONEXISTEN'); #or any mssql_* func
?>
Expected result:
----------------
Hello World
Actual result:
--------------
Hello World
Hello World
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 05:00:01 2025 UTC |
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. <?php function error_handler() { die ('Hello World'.PHP_EOL); } set_error_handler('error_handler'); mssql_connect('correct','mssql','dsn'); #connect successfull mssql_select_db('NONEXISTEN'); # trigger_error ?> after output 'Hello world' - program hung-up (mod_php & cli)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