Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121576 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61942 invoked from network); 4 Nov 2023 08:32:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Nov 2023 08:32:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A0DA5180505 for ; Sat, 4 Nov 2023 01:32:56 -0700 (PDT) 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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS200350 178.154.224.0/19 X-Spam-Virus: No X-Envelope-From: Received: from forward501b.mail.yandex.net (forward501b.mail.yandex.net [178.154.239.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 4 Nov 2023 01:32:55 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:1fa2:0:640:231a:0]) by forward501b.mail.yandex.net (Yandex) with ESMTP id 55E8761142 for ; Sat, 4 Nov 2023 11:32:53 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id qWU886DW0Sw0-XB59iHSU; Sat, 04 Nov 2023 11:32:52 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=php.watch; s=mail; t=1699086772; bh=K7677FqL9m18URKVHhQARadBJ4yJHbHePqRlrWX/Dls=; h=To:Subject:Message-ID:References:Date:From:In-Reply-To:Cc; b=Iu0QT/xjr+Sgq4hYWswyFoytnLFjAb5KG/vjtWPBRiZmyu89E6l/Jb23pSnYYYwA2 j6qbCEZ0eCDn2he6OsRTBax/JxXMykKFh/c7X9jGj42gBGtfko54mwl+uNrM4mvvbH WIXXpBq8+NYkyFDC2izi8Gt/HwtwfULvGe64hPf4= Authentication-Results: mail-nwsmtp-smtp-production-main-38.myt.yp-c.yandex.net; dkim=pass header.i=@php.watch Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-507c5249d55so3722745e87.3 for ; Sat, 04 Nov 2023 01:32:52 -0700 (PDT) X-Gm-Message-State: AOJu0YwA/utD5BYNgBWKSov127Gl8Ksq1UJbXXFaOhRcnJvZ95PUJiSm AtOqEHTAkyvDfPKoaoXWp/wM17l+Rrf3GEhBX1w= X-Google-Smtp-Source: AGHT+IEelXX/uOMEFBer+HRf2H6V8S0LUMxQizBqEiBjswWND42C3NkF19Ix/Dwz+jFo+MVgccARs75Raw0UTqlWviI= X-Received: by 2002:a05:6512:3e1a:b0:500:7a23:720b with SMTP id i26-20020a0565123e1a00b005007a23720bmr22139500lfv.55.1699086772224; Sat, 04 Nov 2023 01:32:52 -0700 (PDT) MIME-Version: 1.0 References: <734FB3C6-EBE6-4F35-8738-436AF7D8B161@sakiot.com> In-Reply-To: <734FB3C6-EBE6-4F35-8738-436AF7D8B161@sakiot.com> Date: Sat, 4 Nov 2023 15:32:25 +0700 X-Gmail-Original-Message-ID: Message-ID: To: Saki Takamachi Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Fix the inconsistent behavior of PDO::PARAM_XXX From: ayesh@php.watch (Ayesh Karunaratne) > > Hi internals, > > As shown in the following issue, the behavior of `PDO::PARAM_XXXX` is inc= onsistent and I would like to fix this. > https://github.com/php/php-src/issues/12603 > > First, I tried fixed pdo_pgsql. > https://github.com/php/php-src/pull/12605 > > Eventually I plan to make similar changes to all bundled pdos. > > What do you think about these? If there is a reason for the current imple= mentation that should not be changed, it would be very helpful if you could= tell me why. > > Also, if an RFC is required, it would be helpful if you could point it ou= t as well. Personally, I don't think an RFC is necessary since this is some= kind of bug fix. However, I believe the target should be the master branch= as it changes the user experience somewhat. > > [*] I'm not thinking about LOB here, but once I leave them with their exi= sting behavior, I change the behavior of other types. Because LOB have comp= lex behavior, the scope becomes too large. After making this change, I will= test again and post another issue if necessary. > > [*] I would like the type of PARAM_BOOL to be exactly bool, but this woul= d also require changing the behavior of the emulator, and I would not be ab= le to issue a PR for each driver, making the scope too large. For this as w= ell, I will just align it to `int(1)` or `string(1) 't'`, etc., and once th= ese changes are completed, I will verify it and post an issue. > > [*] odbc etc. are not compatible with emulation in the first place. There= are no plans to change this in this context. > > Regards. > > Saki I also commented on the PR, but in the interest of keeping the conversation in the mailing list, I'll summarize my thoughts here as well. I don't think we should change the existing behavior. It may be an xkcd/1172 case, but these kinds of cases are very hard to spot from static analyzers, and are often only surfaced in production only if someone spent enough time to dig deep. It's not helping when certain database softwares try to be forgiving and sloppy with types (looking at you, MySQL). In the PR, I proposed to add new methods (`bindStringValue`, `bingBoolValue`, etc) as a non-BC approach, that also rely on the existing type system to communicate the types and enforce them. Saki said that it might not be possible to introduce 10+ new methods to `PDOStatement`, to which I also agree. However, maybe we can conservatively add the basic four types (BOOL/NULL/INT/STR) as a start.