Commit 2a36f7ae02e6c5033f23053da69d2f39a87a590b
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
Showing
2 changed files
with
7 additions
and
2 deletions
lib/documentmanagement/Document.inc
| @@ -199,9 +199,11 @@ class Document { | @@ -199,9 +199,11 @@ class Document { | ||
| 199 | 199 | ||
| 200 | // {{{ get | 200 | // {{{ get |
| 201 | function &get($iId, $iMetadataVersion=null) { | 201 | function &get($iId, $iMetadataVersion=null) { |
| 202 | + if (!is_numeric($iId)) { | ||
| 203 | + return PEAR::raiseError(_('Non-numeric identifier')); | ||
| 204 | + } | ||
| 202 | $iId = (int)$iId; | 205 | $iId = (int)$iId; |
| 203 | $oDocument = new Document(); | 206 | $oDocument = new Document(); |
| 204 | - // if (!is_numeric($iId)) { print "<pre>Document.inc: 162: "; var_dump($iId); print "</pre>"; } | ||
| 205 | $res = $oDocument->load($iId, $iMetadataVersion); | 207 | $res = $oDocument->load($iId, $iMetadataVersion); |
| 206 | if (PEAR::isError($res)) { | 208 | if (PEAR::isError($res)) { |
| 207 | return $res; | 209 | return $res; |
lib/ktentity.inc
| @@ -628,8 +628,11 @@ class KTEntityUtil { | @@ -628,8 +628,11 @@ class KTEntityUtil { | ||
| 628 | } | 628 | } |
| 629 | 629 | ||
| 630 | function &get($sClassName, $iId) { | 630 | function &get($sClassName, $iId) { |
| 631 | - /* */ | 631 | + if (!is_numeric($iId)) { |
| 632 | + return PEAR::raiseError(_('Non-numeric identifier')); | ||
| 633 | + } | ||
| 632 | $iId = (int)$iId; | 634 | $iId = (int)$iId; |
| 635 | + /* */ | ||
| 633 | $sProxyClass = KTEntityUtil::_getProxyClass($sClassName); | 636 | $sProxyClass = KTEntityUtil::_getProxyClass($sClassName); |
| 634 | $oObject =& new $sProxyClass($iId); | 637 | $oObject =& new $sProxyClass($iId); |
| 635 | $res = $oObject->getId(); | 638 | $res = $oObject->getId(); |