Newsgroups: php.internals,php.internals Path: news.php.net Xref: news.php.net php.internals:101877 php.internals:101878 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49929 invoked from network); 15 Feb 2018 17:00:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2018 17:00:35 -0000 Received: from [127.0.0.1] ([127.0.0.1:17308]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 58/2A-26725-2BCB58A5 for ; Thu, 15 Feb 2018 12:00:35 -0500 Authentication-Results: pb1.pair.com header.from=aljosha.papsch@vinexus.eu; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=aljosha.papsch@vinexus.eu; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain vinexus.eu designates 78.46.1.118 as permitted sender) X-PHP-List-Original-Sender: aljosha.papsch@vinexus.eu X-Host-Fingerprint: 78.46.1.118 dedi718.your-server.de Received: from [78.46.1.118] ([78.46.1.118:34625] helo=dedi718.your-server.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/2A-26725-D0BB58A5 for ; Thu, 15 Feb 2018 11:53:34 -0500 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by dedi718.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1emMml-0001tC-Pt; Thu, 15 Feb 2018 17:53:27 +0100 Received: from [80.146.188.122] (helo=[192.168.7.164]) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.84_2) (envelope-from ) id 1emMml-0001A2-Ja; Thu, 15 Feb 2018 17:53:27 +0100 To: Andrew Nester , Dan Ackroyd Cc: =?UTF-8?Q?Johannes_Schl=c3=bcter?= , "internals@lists.php.net" References: <1907EFF3-ED77-4F5C-85AA-CDFE323369C5@bk.ru> <880CDC06-17D6-4E40-8A48-F2E1CB405667@bk.ru> <2A653728-97CA-4AA5-BA30-5BF26FABBC2A@bk.ru> <1501512881.14647.31.camel@schlueters.de> <94973CB5-A3F8-4BE4-9A78-8F759D1829E7@bk.ru> <1501515189.14647.35.camel@schlueters.de> <30F12FDF-4FC0-4B26-B122-EEB62C50010B@bk.ru> Message-ID: <9e4235f6-82e3-aef5-4543-563a158cc6ca@vinexus.eu> Date: Thu, 15 Feb 2018 17:53:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <30F12FDF-4FC0-4B26-B122-EEB62C50010B@bk.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: aljosha.papsch@vinexus.eu X-Virus-Scanned: Clear (ClamAV 0.99.3/24317/Thu Feb 15 10:21:24 2018) Subject: Re: [PHP-DEV] [Request][Discussion] Introduce interfaces PDOInterface and PDOStatementInterface From: aljosha.papsch@vinexus.eu (Aljosha Papsch) Am 06.08.2017 um 17:12 schrieb Andrew Nester: > > >> 6 авг. 2017 г., в 16:30, Dan Ackroyd написал(а): >> >> Andrew Nester wrote: >>> I am thinking about writing an RFC for this and continue discussion there. >>> Will it be a good idea? >> >> You're apparently not very good at listening to suggestions, so I'll >> be more direct. >> >> I think you're wasting people's time until you actually try seeing if >> PDO can be made to work with userland classes or not. >> >> The next step should be you (or anyone else) attempting to make the >> required changes to PDO to make it work, to discover what changes >> would be needed to allow using userland classes. >> >> If it isn't known what is needed to do to support it working, there is >> no point raising the RFC. >> >> >> Johannes Schlüter wrote: >>> The actually question is: Why not? >> >> My understanding is that some of the internal code that calls userland >> functions and methods is basically bogus. >> >> I had a PR (which I haven't had the energy to get round to sorting >> out) to make the SPL call userland constructors correctly: >> https://github.com/php/php-src/pull/1196 >> >> My surprise level would be zero, if there were similar issues in PDO >> instantiating user classes, or other issues like the internal code >> accessing properties directly without going through method access. >> >> On the other hand, it might 'just work'. >> >> cheers >> Dan >> Ack > > Thanks for your feedback, I appreciate this. > > Yes, I understand what you mean. > Fixing using this PDO attribute will solve issue with persistent PDO and will allow to customize PDO in all cases. > > But what I want to suggest is more straightforward way to customize PDO behaviour and have proper type hints at the same time, because at my opinion using PDO attributes for customization is not very straightforward. > > I shown you some examples of use cases of these interfaces. As I think example from Doctrine DBAL shows that this might be useful. Let me know if you would like to see some others. > > I would like to hear some arguments why my proposed solution will not work or what exactly wrong with interfaces proposed and solution in general. > > Thanks in advance. > > Let me revive this thread. I submitted bug #74957 and therefore I am in favor of the interfaces. My original motivation for the bug report was having a custom implementation which would be able to catch from the original PDO "MySQL server has gone away" and broken pipes, arising from idle connections being reused after a while. This not only happens in mostly idle daemons, but could also happen in this circumstance: 1. two connections are opened: log and work. 2. log connection is used. 3. work connection is used, blocking for several minutes. 4. log connection is used again. Result is broken pipe for the log connection. Now, I'm not too sure if the custom PDO implementation will help for this use case (catching broken pipes), because in one app instance PDO triggers an error and in another instance it causes a shutdown. Same app version, both PHP 7.1. The interfaces would still be a nice addition. They provide a good basis for experimentation. They allow general straight forward customization of PDO, i.e. not having to find out about the arcane and funny looking customization method PDO:: ATTR_STATEMENT_CLASS, which is also restricted to PDOStatement customization. Best regards Aljosha