diff --git t3lib/db/class.t3lib_db_preparedstatement.php t3lib/db/class.t3lib_db_preparedstatement.php index ec602c9..62848b7 100644 --- t3lib/db/class.t3lib_db_preparedstatement.php +++ t3lib/db/class.t3lib_db_preparedstatement.php @@ -213,6 +213,11 @@ class t3lib_db_PreparedStatement { throw new InvalidArgumentException('$value is not a boolean as expected: ' . $value, 1281868687); } break; + case self::PARAM_NULL: + if (!is_null($value)) { + throw new InvalidArgumentException('$value is not NULL as expected: ' . $value, 1281868687); + } + break; } $key = is_int($parameter) ? $parameter - 1 : $parameter; @@ -251,8 +256,8 @@ class t3lib_db_PreparedStatement { if (count($input_parameters) > 0) { $parameterValues = array(); - foreach ($input_parameters as $value) { - $parameterValues[] = array( + foreach ($input_parameters as $key => $value) { + $parameterValues[$key] = array( 'value' => $value, 'type' => $this->guessValueType($value), ); @@ -447,6 +452,10 @@ class t3lib_db_PreparedStatement { $query = implode('', $parts); } } else { + if (!preg_match('/^:[\w]+$/', $key)) { + throw new InvalidArgumentException('Parameter names must start with ":" followed by at least one alphanumerical character.', 1282348825); + } + for ($i = 1; $i < count($precompiledQueryParts['queryParts']); $i++) { if ($precompiledQueryParts['queryParts'][$i] === $key) { $precompiledQueryParts['queryParts'][$i] = $value;