Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113296 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31583 invoked from network); 27 Feb 2021 13:06:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Feb 2021 13:06:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 333071804D1 for ; Sat, 27 Feb 2021 04:55:43 -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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 27 Feb 2021 04:55:42 -0800 (PST) Received: from home.th-ayu.reay.family (unknown [49.48.219.174]) by mail1.25mail.st (Postfix) with ESMTPSA id A314A60744; Sat, 27 Feb 2021 12:55:36 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) In-Reply-To: <499c2591-fb11-1b9d-d402-39f7ec1c6b85@themad.com.au> Date: Sat, 27 Feb 2021 19:55:33 +0700 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <6EC89E9A-035D-4D2B-97D7-845DC4FF3E32@koalephant.com> References: <499c2591-fb11-1b9d-d402-39f7ec1c6b85@themad.com.au> To: Matty The Mad X-Mailer: Apple Mail (2.3608.120.23.2.4) Subject: Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support From: php-lists@koalephant.com (Stephen Reay) > On 27 Feb 2021, at 15:56, Matty The Mad wrote: >=20 > =EF=BB=BFPHP 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. >=20 > The problem is this breaks any sites that use UNSIGNED ZEROFILL = integer fields in MySQL. >=20 > I support a number of websites where the phone numbers and post codes = are all UNSIGNED ZEROFILL. >=20 > The post codes in MySQL are stored as 0800. >=20 > In PHP 8.0 returned as string 0800 > In PHP 8.1 returned as integer 800 >=20 > 8.0.2 > string(10) "0742000000" >=20 > 8.1.0-dev > int(742000000) >=20 > PDO shouldn't really be changing the data. >=20 > 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 PHP 9. >=20 > Matthew Asia >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >=20 I agree it should be configurable, but storing digit strings as integers = is asking for trouble. Edit: Whoops, sending again from on-list address.=