Bug #75595 [Fbk->Opn]: Database connect

From: Date: Thu, 30 Nov 2017 15:39:25 +0000
Subject: Bug #75595 [Fbk->Opn]: Database connect
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212842@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75595&edit=1 ID: 75595 User updated by: markus at prepaid-order dot com Reported by: markus at prepaid-order dot com Summary: Database connect -Status: Feedback +Status: Open Type: Bug Package: PDO MySQL Operating System: ubuntu 16.04 PHP Version: 7.1.12 Block user comment: N Private report: N New Comment: hi, this simple function is inside of any php class. remember (it works) fine !!!! but the catch block never called when pdo resource is null or timed out. this is only the connection to connect the database.You can call any small sql statement no matter. this works fine (only database is online an available). You can stop the mysql instance via /etcInit.d/mysql stop you can make any connection see my PDO DSN string select any table or sql statement, hope you can see the error too... please shut down the database instance and call the php script / connection again,aou will see the error appear. Previous Comments: ------------------------------------------------------------------------ [2017-11-30 14:48:30] requinix@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. According to your description the problem would be somewhere within generateErrorPlistWithFailReason... ------------------------------------------------------------------------ [2017-11-30 13:15:59] markus at prepaid-order dot com Description: ------------ simple mariadb PDO connect and give result after success... when Database is available all worked fine.... shut down DB instance manual and host is not available call simple php script with this function... if Database is down catch block will not work and php is working and after that following Message appear. Fatal error: Allowed memory size of 629145600 bytes exhausted (tried to allocate 20480 bytes) my php function shows like this. the Code worked before,source code have never changed. tested with arbitrary php_memory limit,but the issue is still available... testet with php 5.6,7.0,7.1 (default)... it works fine with 7.1,but have no idea... timeout array in PDO constructor have also removed... Test script: --------------- > function getDBConnection() > { > global $pdo; > try { > if ($pdo == null) > $pdo = new PDO( > > 'mysql:host=databaseHost;dbname=someDatabase;charset=utf8mb4', > 'removed', > 'removed_too' > ); > } catch (Exception $ex) { > > generateErrorPlistWithFailReason(ErrorCodes::DATABASE_IS_DOWN, > exit(); > } > return $pdo; > } Expected result: ---------------- resource result and or result from catch block (if databse is down/notavailable)... Actual result: -------------- after timeout Fatal error: Allowed memory size of 629145600 bytes exhausted (tried to allocate 20480 bytes) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75595&edit=1

« previous php.bugs (#212842) next »