|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-04-08 19:14 UTC] crrodriguez at suse dot de
[2008-04-08 19:31 UTC] felipe@php.net
[2008-04-08 21:46 UTC] ob dot php at daevel dot fr
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
Description: ------------ Hello, when catching a connection error in a class extending PDO, the object is not destroyed before end of script. It's really not a big bug, but as the instance is not usable (no instance is returned at all) it should be destroyed no ? Reproduce code: --------------- <?php class PDOtest extends PDO { public function __construct( $dsn, $user, $password ) { try { parent::__construct( $dsn, $user, $password ); } catch( PDOException $e ) { echo 'there is an error... but continue the script', PHP_EOL; return; } } public function __destruct() { echo 'DESTRUCT', PHP_EOL; } } echo 'CONSTRUCT', PHP_EOL; $test = new PDOtest( 'mysql:host=localhost;dbname=test', 'baduser', 'orpass' ); var_dump( $test ); echo 'SOME WORKS', PHP_EOL; ?> Expected result: ---------------- CONSTRUCT there is an error... but continue the script DESTRUCT NULL SOME WORKS Actual result: -------------- CONSTRUCT there is an error... but continue the script NULL SOME WORKS DESTRUCT