Commit 2a36f7ae02e6c5033f23053da69d2f39a87a590b

Authored by nbm
1 parent d151355b

Return PEAR_Error objects when given non-numeric ids with get.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5554 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/Document.inc
... ... @@ -199,9 +199,11 @@ class Document {
199 199  
200 200 // {{{ get
201 201 function &get($iId, $iMetadataVersion=null) {
  202 + if (!is_numeric($iId)) {
  203 + return PEAR::raiseError(_('Non-numeric identifier'));
  204 + }
202 205 $iId = (int)$iId;
203 206 $oDocument = new Document();
204   - // if (!is_numeric($iId)) { print "<pre>Document.inc: 162: "; var_dump($iId); print "</pre>"; }
205 207 $res = $oDocument->load($iId, $iMetadataVersion);
206 208 if (PEAR::isError($res)) {
207 209 return $res;
... ...
lib/ktentity.inc
... ... @@ -628,8 +628,11 @@ class KTEntityUtil {
628 628 }
629 629  
630 630 function &get($sClassName, $iId) {
631   - /* */
  631 + if (!is_numeric($iId)) {
  632 + return PEAR::raiseError(_('Non-numeric identifier'));
  633 + }
632 634 $iId = (int)$iId;
  635 + /* */
633 636 $sProxyClass = KTEntityUtil::_getProxyClass($sClassName);
634 637 $oObject =& new $sProxyClass($iId);
635 638 $res = $oObject->getId();
... ...