summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Newnham <mark@newnhams.com>2026-02-20 10:42:42 -0700
committerMark Newnham <mark@newnhams.com>2026-02-20 10:42:42 -0700
commit016d25e2bf13e43fc8b45088318459a234ef8c21 (patch)
treea00a1e602d9c3ad1b64d08ee46ecb9b31f64009b
parente1982bb3dbce817fcba4776d0f08349a26dc5f17 (diff)
downloadadodb-016d25e2bf13e43fc8b45088318459a234ef8c21.tar.gz
adodb-016d25e2bf13e43fc8b45088318459a234ef8c21.tar.bz2
adodb-016d25e2bf13e43fc8b45088318459a234ef8c21.zip
Validates method for out-of-bound indexes
-rw-r--r--adodb.inc.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/adodb.inc.php b/adodb.inc.php
index 485ae4ea..5589835c 100644
--- a/adodb.inc.php
+++ b/adodb.inc.php
@@ -5559,13 +5559,21 @@ class ADORecordSet implements IteratorAggregate {
}
/**
- * @param int [$fieldOffset]
+ * @param int $fieldOffset The required offset
*
- * @return \ADOFieldObject
+ * @return false|\ADOFieldObject
*/
function FetchField($fieldOffset = -1) {
if (isset($this->_fieldobjects)) {
- return $this->_fieldobjects[$fieldOffset];
+ if (array_key_exists($fieldOffset, $this->_fieldobjects)) {
+ return $this->_fieldobjects[$fieldOffset];
+ } else {
+ return false;
+ }
+ }
+
+ if (!array_key_exists($fieldOffset, $this->_colnames)) {
+ return false;
}
$o = new ADOFieldObject();
$o->name = $this->_colnames[$fieldOffset];