Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126218 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id CD3D41A00BC for ; Thu, 23 Jan 2025 17:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1737651680; bh=cDjbWUEkrBw80sZD58yLcbibCiaZ/4uYAQo3zzBmFFs=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=UWsNSnx1AVMmciQCSxkYwWgzpzNhx5/pIw8iS+oxyeq27yEbO8LKOSpnLwW4+UcTL weQXbEDnoaOzsnu2c3DYAZtQrjsCSEVuS5oE992StyB6VJbSiLJoVpxHDObwWmuEK8 cp9uLyPlgutu5M99I8jviLL8lWTZrwtnXkXb4y8K8j8e7XSjFEoeGL9zn8+2iVDwhq 9MRj9G85SHLHfuSsO9Cpo9YzP5lmPAwwucE9vbGxXB87KKwEFRqxd0sESWepO7euli A6rYy6KgFAToYKuOLKgTWG7RKa2DOsebHoHIGZjh40Ifwu26VIcdSkvaBNnGwu0HAQ 6jijRMfeJDuQg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 97BB618003C for ; Thu, 23 Jan 2025 17:01:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 23 Jan 2025 17:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail3; t=1737651845; x=1737911045; bh=cDjbWUEkrBw80sZD58yLcbibCiaZ/4uYAQo3zzBmFFs=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=uWKPRXwIhmFgvXVO4fryiGappozyRloqxXsZ8zeVT1dWJVqeeLq8ekVGs1okJ2bPX l24BR0Y7/0IH4/gtSbJnEOARKITB32q2YRA5GTIbjOn/MMpxDJThnrjhJjlaF0esG8 lrh0wiLyrnk1OlO1+z2T2MTd47IxG5RhMbsWxE2j033+EdIRo5xepz8FYtUkJhKksU kHRCe2UEWiF+TKuLXQGfxylDmCAHNFNYmQdE3BdH5xREvhBCAOnyRODTiWCqveMyeW UB4G74IVmxnObRHg9Q2rJT1WJoA9edaVFNA2ANkLgzzMC0meZTOcLnmTo2WoZEy3vl EjYYAT2dzQXNQ== Date: Thu, 23 Jan 2025 17:03:59 +0000 To: Kamil Tekiela Cc: PHP internals Subject: Re: [PHP-DEV] Use usual semantics for PDO::FETCH_CLASS constructor arguments Message-ID: In-Reply-To: References: Feedback-ID: 96993444:user:proton X-Pm-Message-ID: 92ef1d23a1e24856f15ad451e58750c5bceae84a Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Tuesday, 21 January 2025 at 12:36, Kamil Tekiela = wrote: > Hi Gina, >=20 > Your proposal makes sense to me. I agree that the behaviour should be > consistent. > If I understand correctly, an associative array currently binds only > to positional arguments. If you make this change, how will it interact > with PDO::FETCH_PROPS_LATE? Am I correct in assuming that this will > also be a BC break? Will the values coming from the DB take over if no > matching param is found in the constructor array? >=20 > Regards, > Kamil I'm not exactly sure to understand the concern. PDO assigns values directly to properties using the column name as the prop= erty name, and if the property does not exist, create a dynamic one. By default, PDO will assign the properties prior to calling the constructor= with the provided constructor arguments. Using PDO::FETCH_PROPS_LATE the order is flipped, the constructor is called= first with the provided arguments, and then PDO populates the properties. What the constructor does with the constructor arguments is up to the const= ructor. If it overwrites a property / set a default value then yes this can overwri= te values from the DB. But this issue already exists with positional arguments. And the constructor could do something completely different with the provid= ed arguments that do not interfere at all with values coming from the DB. Hope this clarifies the behaviour. Best regards, Gina P. Banyard