[BUGFIX] exec_SELECTcountRows returns string
authorGeorg Ringer <mail@ringerge.org>
Tue, 23 Aug 2011 04:04:06 +0000 (06:04 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Wed, 24 Aug 2011 14:14:28 +0000 (16:14 +0200)
PHPdoc states that return value is either FALSE if
something strange happened or integer with the count of
records.

MySql returns strings, so an intval is needed to have integers

Change-Id: Ia4e7ff88620ac861f40035ab4f97a20d81115ea7
Resolves: #29169
Releases: 4.6, 4.5, 4.4
Reviewed-on: http://review.typo3.org/4567
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
t3lib/class.t3lib_db.php

index e229543..4098add 100644 (file)
@@ -397,6 +397,7 @@ class t3lib_DB {
                $resultSet = $this->exec_SELECTquery('COUNT(' . $field . ')', $table, $where);
                if ($resultSet !== FALSE) {
                        list($count) = $this->sql_fetch_row($resultSet);
+                       $count = intval($count);
                        $this->sql_free_result($resultSet);
                }
                return $count;