Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113303 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48841 invoked from network); 27 Feb 2021 15:43:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Feb 2021 15:43:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B32251804B3 for ; Sat, 27 Feb 2021 07:32:45 -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,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-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 ; Sat, 27 Feb 2021 07:32:45 -0800 (PST) Received: by mail-lj1-f172.google.com with SMTP id 2so9571654ljr.5 for ; Sat, 27 Feb 2021 07:32:45 -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=41blWO0ZWKoE9jlczOZtJdOfiwLIPEFjK0/6K1AemgE=; b=NmJZbIRPS5vHv8XS5QAel2RcZE7icmokiBSdzcX3yjq3XC0DFxIKgbMCMNDgnL+G+B kFsNf5rMh+z1+bii6D9bxchwNzAMw4dECq3fzm8WybWTOeQkWrvMaq3MUGpndZCFW+ye qMnNQw+e1sJzWSHNp5QvhqUBsWSEQp+Inh0HvxcgIND60boE/R0wsvbxluJNHi9bDF1/ yIgugJeX75QCrr3jKkPcHvnum0d6L3IzaBv42zeyRRlcbuui/Qq0/ZxoP49/vBAbHIrL rlMj6kjq7dJ12mARaYWqhHOrnorDRg0DFkznZLyttNffL6vuXBSso68432Z+nTXQ2At+ FINw== 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=41blWO0ZWKoE9jlczOZtJdOfiwLIPEFjK0/6K1AemgE=; b=U2vCmK7NuYiTR1XPL1k3n5Z8Lch/i7Q0jn81A65PqnXGwnwtiIipxooZEbDy/9U8VV uM3V4Gh3M5/evSNsYm46Id3Jxo9wIIoZ8Vl/Rupa0GFreRJLg37fYDfZKDC6A/xLGSDf DAwPeWToPRolwlo0vSJY6j/0XwrgDRr797WOCaGR2hP2rrZULMGsxy8ubK7S7zb4T9yv /4B9CFPwLyiDtZbJoj6g3VlsKkm+inB6lRwFuoWN1kbdeISMTuPxz4vS0Fl64hIp6AE6 HEAhfAKHXNMvq+uHuqLFDcXEWuUC4MXRKTLYG7FCJFBejSvJn30K+0COLlcaQS/CfNto f6nQ== X-Gm-Message-State: AOAM5332vbcOWzCaVbycEh1oF7rRP69DjMKq0esQG0kbc/+uR9sHGRkp n4m5ykfoimrN64aYbnjtpBumiT/2LgH24B909MXJ7BZj6+KnrQ== X-Google-Smtp-Source: ABdhPJy7iZV+3ErDP3f2aB387J9V4zIEZ1/a8CZuC80XCZqsmILRq+NnXCdBt/7Ty1T4aVf1Lguxtr9Yu70xcrCHU1I= X-Received: by 2002:a2e:978b:: with SMTP id y11mr3809909lji.452.1614439960266; Sat, 27 Feb 2021 07:32:40 -0800 (PST) MIME-Version: 1.0 References: <499c2591-fb11-1b9d-d402-39f7ec1c6b85@themad.com.au> In-Reply-To: <499c2591-fb11-1b9d-d402-39f7ec1c6b85@themad.com.au> Date: Sat, 27 Feb 2021 16:32:23 +0100 Message-ID: To: Matty The Mad Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000057c98305bc53186f" Subject: Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support From: nikita.ppv@gmail.com (Nikita Popov) --00000000000057c98305bc53186f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Feb 27, 2021 at 9:50 AM Matty The Mad wrote: > PHP 8.1 PDO has been changed so that when MySQL returns an integer it > will no longer be returned as a string, but as an int. > > The problem is this breaks any sites that use UNSIGNED ZEROFILL integer > fields in MySQL. > > I support a number of websites where the phone numbers and post codes > are all UNSIGNED ZEROFILL. > > The post codes in MySQL are stored as 0800. > > In PHP 8.0 returned as string 0800 > In PHP 8.1 returned as integer 800 > > 8.0.2 > string(10) "0742000000" > > 8.1.0-dev > int(742000000) > > PDO shouldn't really be changing the data. > > I propose that: > =E2=80=A2 any ZEROFILL integers are returned as string [or] > =E2=80=A2 there's an option to control this when making the connection (I= don't > want to str_pad() at every place I've used ZEROFILL in the past) [or] > =E2=80=A2 this backwards compatibility breaking change is removed until P= HP 9. > > Matthew Asia > To clarify, what changed in PHP 8.1 is that emulated prepares now produce the same results as native prepares. Or from a technical perspective, that you get the same results independently of whether the text protocol or the binary protocol is used to communicate with the MySQL server. The handling of ZEROFILL does look like a bug to me. We should return values with leading zeros as strings for both protocols. For reference, this issue is tracked at https://bugs.php.net/bug.php?id=3D80808. Regards, Nikita --00000000000057c98305bc53186f--