[dev] custom horde apps: Horde_Rdo PHP7 behavior change on mysql

Ralf Lang lang at b1-systems.de
Fri Sep 15 13:10:48 UTC 2017


Hi,

I recently spent some time figuring this out

on php 5.3, I used to have a situation where I would create a 
Horde_Rdo_Base object by sending only a limited set of array keys to the 
related mapper->create() function. Any other fields would default to 
null or the field's default value as set by the databases.

It seems this somehow changes in php7. For unset keys, Rdo seems to try 
and create the db row with null instead of the schema-provided default 
value and fail.

I am still unsure if this is in Rdo's code or in Horde_Db or in Pdo/Sql.

I will try to corner this situation next week and provide a unit test or 
a fix.

For now, overloading create() for the respective mapper may work around this

     public function create(array $fields)
     {
         if (empty($fields['somefield'])) {
             $fields['somefield'] = 'somedefault';
         }
         return  parent::create($fields);
     }



-- 
Ralf Lang
Linux Consultant / Developer
Tel.: +49-170-6381563
Mail: lang at b1-systems.de
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537


More information about the dev mailing list