From 28d70194c8b33333e25f130750f03e6fdfaa30f4 Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Sat, 28 Mar 2026 12:01:54 +0000 Subject: [PATCH] drt --- PHPExcel/PHPExcel/Cell/DefaultValueBinder.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php b/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php index d1501b8..1ec3523 100755 --- a/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php +++ b/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php @@ -79,15 +79,22 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder return PHPExcel_Cell_DataType::TYPE_STRING; } elseif ($pValue instanceof PHPExcel_RichText) { return PHPExcel_Cell_DataType::TYPE_INLINE; - } elseif ($pValue[0] === '=' && strlen($pValue) > 1) { + } + + // CORRECTION ICI : On vérifie si c'est une string avant d'accéder à [0] + elseif (is_string($pValue) && strlen($pValue) > 1 && $pValue[0] === '=') { return PHPExcel_Cell_DataType::TYPE_FORMULA; - } elseif (is_bool($pValue)) { + } + + elseif (is_bool($pValue)) { return PHPExcel_Cell_DataType::TYPE_BOOL; } elseif (is_float($pValue) || is_int($pValue)) { return PHPExcel_Cell_DataType::TYPE_NUMERIC; } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) { $tValue = ltrim($pValue, '+-'); - if (is_string($pValue) && $tValue[0] === '0' && strlen($tValue) > 1 && $tValue[1] !== '.') { + + // CORRECTION ICI AUSSI : On s'assure que $tValue est une string et n'est pas vide + if (is_string($tValue) && strlen($tValue) > 1 && $tValue[0] === '0' && $tValue[1] !== '.') { return PHPExcel_Cell_DataType::TYPE_STRING; } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) { return PHPExcel_Cell_DataType::TYPE_STRING; @@ -100,3 +107,4 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder return PHPExcel_Cell_DataType::TYPE_STRING; } } +