Skip to content

Commit c8cadb4

Browse files
committed
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);
1 parent 2c5a4d6 commit c8cadb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/form/sfForm.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public function isBound()
316316
*/
317317
public function updateValues(array $values)
318318
{
319-
$this->values = $values + $this->values;
319+
$this->values = $values + (isset($this->values) ? $this->values : array());
320320

321321
$this->updateValuesEmbeddedForms($values);
322322
}

0 commit comments

Comments
 (0)