scoumbourdis / grocery-crud-codeigniter-4

GNU General Public License v3.0
68 stars 38 forks source link

strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated #25

Open rrit-service opened 2 years ago

rrit-service commented 2 years ago

PHP 8.1, NULL in a text field:

APPPATH/Libraries/GroceryCrud.php at line 262

255                     $value = $this->default_true_false_text[$value];
256                 }
257                 break;
258             case 'string':
259                 $value = $this->character_limiter($value,$this->character_limiter,"...");
260                 break;
261             case 'text':
262                 $value = $this->character_limiter(strip_tags($value),$this->character_limiter,"...");
263                 break;
264             case 'date':
265                 if(!empty($value) && $value != '0000-00-00' && $value != '1970-01-01')
266                 {
267                     list($year,$month,$day) = explode("-",$value);
268 
269                     $value = date($this->php_date_format, mktime (0, 0, 0, (int)$month , (int)$day , (int)$year));
rrit-service commented 2 years ago

as possible fix:


            case 'text':
                if (!is_null($value)) {
                    $value = $this->character_limiter(strip_tags($value),$this->character_limiter,"...");
                }               
                break;