Correctly handle `null` in benchmark parameter insertion
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Feb 2021 09:26:33 +0000 (10:26 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Feb 2021 09:26:33 +0000 (10:26 +0100)
see 048aaf0c318f01d11da4f6b8c01b6fdd1acbcb7a

wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php

index 1038406376efde008e29cc3ccc8f9c887468185f..35668c0620bb75c91a9ae0d10ab0e139c2833382 100644 (file)
@@ -103,7 +103,12 @@ class PreparedStatement
                                 return $matches[0];
                             }
 
-                            return "'" . \substr(\array_shift($benchmarkParameters), 0, 100) . "'";
+                            $parameter = \array_shift($benchmarkParameters);
+                            if ($parameter === null) {
+                                return 'NULL';
+                            }
+
+                            return "'" . \substr($parameter, 0, 100) . "'";
                         },
                         $this->query
                     ),