Fixed a bug in t3lib_beFunc::getRecordWSOL - it now makes sure that uid, pid and...
authorRobert Lemke <robert.lemke@typo3.org>
Fri, 16 Dec 2005 20:49:35 +0000 (20:49 +0000)
committerRobert Lemke <robert.lemke@typo3.org>
Fri, 16 Dec 2005 20:49:35 +0000 (20:49 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@914 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php

index ec4e29d..4608d0b 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+2005-12-16     Robert Lemke    <robert@typo3.org>
+       * Fixed a bug in t3lib_beFunc::getRecordWSOL - it now makes sure that uid, pid and t3ver_swapmode are selected internally if they are not specified in $fields
 
 2005-12-13  Martin Kutschker  <martin.t.kutschker@blackbox.net>
 
index 8fb3f95..e053f64 100755 (executable)
@@ -239,9 +239,23 @@ class t3lib_BEfunc {
         * @param       string          Additional WHERE clause, eg. " AND blablabla=0"
         * @return      array           Returns the row if found, otherwise nothing
         */
-       function getRecordWSOL($table,$uid,$fields='*',$where='')       {
-               $row = t3lib_BEfunc::getRecord($table,$uid,$fields,$where);
-               t3lib_BEfunc::workspaceOL($table,$row);
+       function getRecordWSOL($table,$uid,$fields='*',$where='') {
+               if ($fields !== '*') {
+                       $internalFields = t3lib_div::uniqueList($fields.',uid,pid'.($table == 'pages' ? ',t3ver_swapmode' : ''));
+                       $row = t3lib_BEfunc::getRecord($table,$uid,$internalFields,$where);
+                       t3lib_BEfunc::workspaceOL($table,$row);
+       
+                       if (is_array ($row)) {
+                               foreach (array_keys($row) as $key) {
+                                       if (!t3lib_div::inList($fields, $key) && $key{0} !== '_') {
+                                               unset ($row[$key]);
+                                       }
+                               }       
+                       }
+               } else {
+                       $row = t3lib_BEfunc::getRecord($table,$uid,$fields,$where);
+                       t3lib_BEfunc::workspaceOL($table,$row);
+               }               
                return $row;
        }