custom horde apps: Horde_Rdo PHP7 behavior change on mysql
Ralf Lang <[email protected]> Fri, 15 Sep 2017 15:10:48 +0200
| Newsgroups | gmane.comp.horde.devel |
|---|---|
| Message-ID | <[email protected]> |
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: [email protected]
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
dev mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]