Commit 2ba80b5bc53f75ccec4a06bbd9e4660b7dee95cd

Authored by Mark Holtzhausen
1 parent 19d5440d

KTAPI ByRef Fixes

Some KTAPI functions return non-reference values by reference. this is now fixed in these instances. There are other instances that still need to be fixed.
ktapi/KTAPISession.inc.php
... ... @@ -379,7 +379,8 @@ class KTAPI_UserSession extends KTAPI_Session
379 379  
380 380 if (PEAR::isError($authenticated) || $authenticated === false)
381 381 {
382   - return new KTAPI_Error(_kt("The password is invalid."),$authenticated);
  382 + $ret=new KTAPI_Error(_kt("The password is invalid."),$authenticated);
  383 + return $ret;
383 384 }
384 385  
385 386 if (is_null($ip))
... ... @@ -424,7 +425,8 @@ class KTAPI_UserSession extends KTAPI_Session
424 425 $row = DBUtil::getOneResult($sql);
425 426 if (is_null($row) || PEAR::isError($row))
426 427 {
427   - return new KTAPI_Error(KTAPI_ERROR_SESSION_INVALID, $row);
  428 + $ret= new KTAPI_Error(KTAPI_ERROR_SESSION_INVALID, $row);
  429 + return $ret;
428 430 }
429 431  
430 432 $sessionid = $row['id'];
... ...
lib/authentication/builtinauthenticationprovider.inc.php
... ... @@ -51,7 +51,8 @@ class KTBuiltinAuthenticationProvider extends KTAuthenticationProvider {
51 51 function &getAuthenticator($oSource) {
52 52 // $oSource is null, since the built-in authentication provider
53 53 // only has a single, non-registered, instance.
54   - return new BuiltinAuthenticator;
  54 + $ret= new BuiltinAuthenticator();
  55 + return $ret;
55 56 }
56 57  
57 58 function showUserSource($oUser, $oSource) {
... ...
lib/database/dbutil.inc
... ... @@ -168,7 +168,8 @@ class DBUtil {
168 168 if ($bNoId)
169 169 return;
170 170 else
171   - return $db->getLastId();
  171 + $ret=$db->getLastId();
  172 + return $ret;
172 173 }
173 174 if (PEAR::isError($res)) {
174 175 DBUtil::logQueryError(DBUtil::lastQuery($db), $res);
... ...
lib/ktentity.inc
... ... @@ -749,7 +749,7 @@ class KTEntityUtil {
749 749 /* */
750 750 }';
751 751  
752   - $allcode[] = sprintf('function %s ($iId, $aInfo = null) { $this->iId = $iId; $this->aFieldArr = $aInfo; $this->cacheGlobal =& $GLOBALS["_OBJECTCACHE"][%s]; }' . "\n", $sProxyClassName, $sClassName);
  752 + $allcode[] = sprintf('function %s ($iId, $aInfo = null) { $this->iId = $iId; $this->aFieldArr = $aInfo; $this->cacheGlobal =& $GLOBALS["_OBJECTCACHE"]["%s"]; }' . "\n", $sProxyClassName, $sClassName);
753 753  
754 754 $gen = sprintf("class %s extends %s {\n", $sProxyClassName, $sClassName);
755 755 $gen .= " " . join("\n ", $allcode) . "\n";
... ...