[BUGFIX] t3lib_db::exec_SELECTgetRows method annotation
authorNicole Cordes <n.cordes@biz-design.biz>
Tue, 31 Jul 2012 14:48:20 +0000 (16:48 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 1 Aug 2012 13:26:17 +0000 (15:26 +0200)
The function returns a NULL value if a sql error occurs.

Change-Id: Ic508aa5ba2034c0a230f5fad56690979ed576bf4
Fixes: #39417
Releases: 6.0, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/13408
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_db.php

index 4098add..debcf3d 100644 (file)
@@ -328,7 +328,7 @@ class t3lib_DB {
         * @param       string          See exec_SELECTquery()
         * @param       string          See exec_SELECTquery()
         * @param       string          If set, the result array will carry this field names value as index. Requires that field to be selected of course!
-        * @return      array           Array of rows.
+        * @return array|NULL Array of rows, or NULL in case of SQL error
         */
        function exec_SELECTgetRows($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy = '', $limit = '', $uidIndexField = '') {
                $res = $this->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy, $orderBy, $limit);
@@ -338,7 +338,6 @@ class t3lib_DB {
 
                if (!$this->sql_error()) {
                        $output = array();
-
                        if ($uidIndexField) {
                                while ($tempRow = $this->sql_fetch_assoc($res)) {
                                        $output[$tempRow[$uidIndexField]] = $tempRow;
@@ -350,7 +349,10 @@ class t3lib_DB {
                                array_pop($output);
                        }
                        $this->sql_free_result($res);
+               } else {
+                       $output = NULL;
                }
+
                return $output;
        }