Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112767 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 33024 invoked from network); 5 Jan 2021 17:09:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Jan 2021 17:09:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E83C71804F3 for ; Tue, 5 Jan 2021 08:45:52 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 5 Jan 2021 08:45:52 -0800 (PST) Received: by mail-lf1-f43.google.com with SMTP id a12so74122063lfl.6 for ; Tue, 05 Jan 2021 08:45:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uExtzyhSY6atNDDYtbv3luXMrnEl6SbbgmZ1qnwUkg8=; b=AP7Uz395URNxqdtZwWCS2mGH7xFLlZx9+S95mqpM/a32kXBlUzkpAeRE6/HW2W0YYv /B2xNmHeRQYtswenzmrPBR2uhO1/NyycfENFJkqHvnYP0t7LfZXjX6CTG5x0g3YhP/Nc HOAgju5B5MQkQ+M/32+gzt8VITJ138Dph5J85fDIONEk8A8QQj1ay5nHSJ+5MPzfzMuc EBqFkKlz5ST4X2prT1bB3kZbqlL42/4pZA0+oYLE3L9Wp8jorIoIpx8rYXQwkmOgWpbx vKxwzKW4txOtliye3GUl8XwD1+QU2oIEAKoScfs7Y9dLXxu4rkxClPs2ewTyxdkrTrLo ircw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uExtzyhSY6atNDDYtbv3luXMrnEl6SbbgmZ1qnwUkg8=; b=WjUc34jgbnG7EOvKS60rI1tJS3UZePuB4hNyZLDUQfe9zmfnu5Feh73Kxc+cnxThuQ 2S3zHoOvFbPDKyPK/v4gq9z6qPQ/fxwPnVHqtTZAbcvgysMxuxGm8Xk9YhgoF+fs7YGk vVS+1ZwDojHE3ifGs6686ExOWP+Vm2u4WeIIy7JMcOCPudXObqT/SjaSBGpNEzNjLkXA 12SrJprlc+g5srw7ctphZkwm6crQc5wWDO8PaNqWzQ1bqufKZAlUyVFnggmo56CoRZh/ 80lRBSVWNFhrWqLu4M+IyLkUEBb801zDqrzwDtCtHE8owuzJbuIlB75+jenWqyQkCeGv r6GA== X-Gm-Message-State: AOAM531HCc/uJDMSCMqGpybOeyrK7UXVhYlcvHxvJ8/3eGGu4KB0rKu+ E4emm+gUYAEL7imBqJ2lFmY4FyBoqpq2AyJ/P3g= X-Google-Smtp-Source: ABdhPJxODTrJDSG/lELR2T2xDm5RTsZiK2vtuKw2Q/fLo/P4ucbga1s2bv05YZFUO6puQXdgH5PzBR4OUTwMe1Tp+YI= X-Received: by 2002:a19:ed6:: with SMTP id 205mr59514lfo.159.1609865150046; Tue, 05 Jan 2021 08:45:50 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 5 Jan 2021 17:45:33 +0100 Message-ID: To: Kamil Tekiela Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000067a6a005b829f0a3" Subject: Re: [PHP-DEV] Mysqli improvements From: nikita.ppv@gmail.com (Nikita Popov) --00000000000067a6a005b829f0a3 Content-Type: text/plain; charset="UTF-8" On Wed, Dec 30, 2020 at 7:33 PM Kamil Tekiela wrote: > Hi Internals, > > I would like to start a discussion about possible improvements to the > mysqli API. I have written an RFC which explains all my ideas. > > https://wiki.php.net/rfc/improve_mysqli > > As the RFC is nothing more than a concept at the moment I am looking > for some feedback. I attempted to implement some of the changes myself > but due to my limited experience with C and PHP internals I didn't get > far. I would appreciate if some volunteer would like to help me to > implement the changes once they are ironed out. > > I understand that the RFC will need to be split up before voting. > > Kind regards, > Kamil Tekiela > This RFC appears to cover mostly unrelated topics: Enable exception error reporting by default: Yes, we should definitely do this. Especially as we did the corresponding PDO change. I think people often don't fully appreciate that in mysqli errors can occur all the way down -- it's not enough to check whether your prepare and execute succeed, you might still get an error during an individual fetch... Bind in execute: Sounds like a good idea. I also glanced over your pull request, and it looks like supporting this is very straightforward. 3onnect_error property: While these probably should have been static methods (I don't think they can really be static properties from a technical perspective), I'm not sure this is a problem worth addressing. If exception mode is enabled by default, why would one ever want to use these properties? Under `''new mysqli'' and ''mysqli_connect()'' are not true aliases`, your point 3 seems like an unneeded rant. When the manual lists a constructor and a procedural equivalent as aliases, the relationship is always the same. Similar to how the documentation can list a property as an alias of a function, even though they aren't technically the same -- duh, who would've thought. Regarding your proposal to clean up the construction mess: * Removing mysqli::init() sounds reasonable to me. I'm having a really hard time coming up with a case where it would even do something sensible. Possibly if you do $mysqli->close() and then want to re-initialize the object? Very dubious... * Aligning mysqli_connect() and new mysqli() without arguments. I don't think we should do this. There are two ways to establish a connection: mysqli_init() + mysqli_real_connect(), or just standalone mysqli_connect(). Allowing mysqli_connect() + mysqli_real_connect() as well doesn't seem like an improvement to me. Really, the "new mysqli()" exception without args should not have existed, instead a static "mysqli::init()" method should take that role. Then "new mysqli" would really be equivalent to "mysqli_connect" and "mysqli::init()" would really be equivalent to "mysqli_init()." I think that rather than removing mysqli->init(), it may make more sense to convert it into a static method. We probably can't remove the "new mysqli" zero args exception for BC reasons, but this would at least make everything else sane and nicely symmetric between procedural and OO style. * Aliasing connect and real_connect. This seems okay to me. Again, the intended usage here is "connect" or "init + real_connect", but I don't see an immediate reason why making this "init + connect" wouldn't work. (Allowing the end-user to specify client capability flags seems pretty dubious, but that's an unrelated issue...) * Deprecating mysqli_set_opt. IMHO the mysqli_set_opt name is better than the mysqli_options one. We only have the latter because it happens to be called mysql_options in the underlying C API. I wouldn't deprecate this alias. libmysqlclient support: This is a tricky question. I have spent some time improving PDO MySQL compatibility with libmysqlclient and our test suite now passes with it. However, the state of mysqli is much worse. We have many failing tests, and also many functions/methods that are only implemented if mysqlnd is used. A possibility here is to drop support for libmysqlclient in mysqli and only support it in PDO, where we have a much smaller API surface to deal with. Regards, Nikita --00000000000067a6a005b829f0a3--