On Tuesday, 21 January 2025 at 12:36, Kamil Tekiela <tekiela...@gmail.com> 
wrote:

> Hi Gina,
> 
> 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?
> 
> Regards,
> Kamil

I'm not exactly sure to understand the concern.
PDO assigns values directly to properties using the column name as the property 
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 
constructor.
If it overwrites a property / set a default value then yes this can overwrite 
values from the DB.
But this issue already exists with positional arguments.
And the constructor could do something completely different with the provided 
arguments that do not interfere at all with values coming from the DB.

Hope this clarifies the behaviour.

Best regards,

Gina P. Banyard

Reply via email to