From 287ee92cb7c73cb71065da61f78552e22abb70d5 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 24 Nov 2025 15:00:15 +0100 Subject: [PATCH] Qual: Fix nullable value by cast (for phan) (#36381) # Qual: Fix nullable value by cast (for phan) The update method now explicitly casts the eatby and sellby fields to integers before passing them to the idate function. Otherwise phan considers the arguments as nullable (as it can not determine the impact of dol_strlen). --- htdocs/reception/class/receptionlinebatch.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/reception/class/receptionlinebatch.class.php b/htdocs/reception/class/receptionlinebatch.class.php index c4df1cc15be..4e5b1ad0217 100644 --- a/htdocs/reception/class/receptionlinebatch.class.php +++ b/htdocs/reception/class/receptionlinebatch.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Christophe Battarel - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2025 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -590,8 +590,8 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " status=".(isset($this->status) ? $this->status : "null").","; $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").","; - $sql .= " eatby=".(dol_strlen((string) $this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').","; - $sql .= " sellby=".(dol_strlen((string) $this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').","; + $sql .= " eatby=".(dol_strlen((string) $this->eatby) != 0 ? "'".$this->db->idate((int) $this->eatby)."'" : 'null').","; + $sql .= " sellby=".(dol_strlen((string) $this->sellby) != 0 ? "'".$this->db->idate((int) $this->sellby)."'" : 'null').","; $sql .= " fk_unit = ".((int) $this->fk_unit); $sql .= " WHERE rowid=".((int) $this->id);