Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113010 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 67411 invoked from network); 27 Jan 2021 18:01:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jan 2021 18:01:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BB4E91804DC for ; Wed, 27 Jan 2021 09:43:14 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.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 ; Wed, 27 Jan 2021 09:43:13 -0800 (PST) Received: by mail-wr1-f43.google.com with SMTP id l12so2824512wry.2 for ; Wed, 27 Jan 2021 09:43:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i1AsjuVO4MHRjeN/CyCMBP6grf1b3jtwBj3vroNeI+Q=; b=Zt6tCc8FxbHd9tAgBtlOUzumudRSwitYJdtQgrvC7FJqNh9XkG81tleaObdqFqEsVU SvGR08/pdaUIKYxQyYKYeN5X0BnddRWBVTM0PCFz9WzYaWimsvP5BibLUOc6GmiAH45Y BHeXElMDmFuawq/4OxjaEpoJ6rbrPpVTUxfUc= 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=i1AsjuVO4MHRjeN/CyCMBP6grf1b3jtwBj3vroNeI+Q=; b=s1/cteJon/j+WKP7fisD7bf7Xu1bLo1wuBsVzEGiXwWFVKa0okGXjK2HxgofxiOB36 Vz0iSJOf9S4I6OgnZcfFXcmf8W5agQ/nR5gghTR04KhGAgaIozv245/1t7BADhoIMC7+ V6aKJugj4iRQ72G/MQjFeuAyuyfFy/YSF3cSE51J/lHRspnVwm/or6S38qN+DsjopY7P IOReJ+JvvU8M12M1dC8buuqMHI3eLHU0VecoFbTFUMSQeZ9GzvMuoMIIPHRLbvwGA+ot qYVFFCS+XTTTbiaCTBdOruwaCiREH1EWFUr3xIhaRjKbkmxy1b301CwjIPo/i38u8xSe esBQ== X-Gm-Message-State: AOAM533l4qfohqIEIOL9+2I+D9GlDuB8NO6xBOLtoFs/gyGx/m6W4iv7 Qi7irBIgfolrl4qkbtmgREAwWeE3Caafml098wED5A== X-Google-Smtp-Source: ABdhPJw8wQ+Hdj6Lt0XCfzcO71RcnxPBitfxhfuxx8SngDNmL+dr06C04Kj4O6AGw/5VC+TyHxStqMrpZoh3w3s/iIE= X-Received: by 2002:adf:f8c1:: with SMTP id f1mr12245555wrq.76.1611769390231; Wed, 27 Jan 2021 09:43:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 27 Jan 2021 17:42:59 +0000 Message-ID: To: Kamil Tekiela Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000f70e8705b9e54d15" Subject: Re: [PHP-DEV] Mysqli bind_param and error exceptions From: craig@craigfrancis.co.uk (Craig Francis) --000000000000f70e8705b9e54d15 Content-Type: text/plain; charset="UTF-8" On Wed, 30 Dec 2020 at 18:33, Kamil Tekiela wrote: > [...] I have written an RFC which explains all my ideas. > https://wiki.php.net/rfc/improve_mysqli Hi Kamil, As there is a discussion about MySQLi raising exceptions, and you're looking at the general mysqli API... When using mysqli_stmt::bind_param(), it won't raise an exception when the number of variables doesn't match the number of parameters, instead it's a Fatal Error: $statement = $db->prepare('SELECT * FROM user WHERE id = ?'); $statement->bind_param('ii', $id, $id); So database abstractions need to do messy things like: if (count($ref_values) != $statement->param_count) { throw new mysqli_sql_exception('Invalid parameter count', 2034); } else { array_unshift($ref_values, $ref_types); call_user_func_array([$statement, 'bind_param'], $ref_values); } Should mysqli_stmt::bind_param() be updated to raise an exception instead? Or, because it's such a broken function (e.g. passing variables by reference, and the annoying $types string), should we just forget about it, and focus on getting mysqli_stmt::execute() to accept an array of parameters? Craig On Wed, 30 Dec 2020 at 18:33, 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --000000000000f70e8705b9e54d15--