From c8cadb413101949316b0759510a1125580259647 Mon Sep 17 00:00:00 2001 From: Tybaze Date: Tue, 14 Feb 2023 18:48:48 +0100 Subject: [PATCH] Fix PHP8.1 sfForm - Unsupported operand types: array + null on sfForm::updateValues() Avoid error : Fatal error: Uncaught TypeError: Unsupported operand types: array + null in lib\form\sfForm.class.php:319 Step to reproduce : $form = new sfForm(); $form->updateValues(array('foo' => 'value')); PHP 5.3 coding style May use sfForm::getValues(), but as sfForm::updateValues() is a hack, it could be used before bind ($this->isBound = true); --- lib/form/sfForm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/form/sfForm.class.php b/lib/form/sfForm.class.php index 2db45bbde..0c520cdd4 100644 --- a/lib/form/sfForm.class.php +++ b/lib/form/sfForm.class.php @@ -316,7 +316,7 @@ public function isBound() */ public function updateValues(array $values) { - $this->values = $values + $this->values; + $this->values = $values + (isset($this->values) ? $this->values : array()); $this->updateValuesEmbeddedForms($values); }