Test for is_array first, get rid of ctype_digit test as passing a null to it is deprecated

This commit is contained in:
Isaac Connor committed 2022-06-01 10:40:31 -04:00
1 parent b47d036b89
commit 8f2b8bf478
1 file changed
+4 -4
+4 -4
View File
@@ -13,15 +13,15 @@ class ZM_Object {
$row = NULL;
if ($IdOrRow) {
if (is_integer($IdOrRow) or ctype_digit($IdOrRow)) {
if (is_array($IdOrRow)) {
$row = $IdOrRow;
} else if (is_integer($IdOrRow)) {
$table = $class::$table;
$row = dbFetchOne("SELECT * FROM `$table` WHERE `Id`=?", NULL, array($IdOrRow));
$row = dbFetchOne('SELECT * FROM `$table` WHERE `Id`=?', NULL, array($IdOrRow));
if (!$row) {
Error("Unable to load $class record for Id=$IdOrRow");
return;
}
} else if (is_array($IdOrRow)) {
$row = $IdOrRow;
}
if ( $row ) {