Commit 637c1163cc7 for php.net

commit 637c1163cc7869d971833545f9ffe7aa9272c822
Author: Kamil Tekiela <tekiela246@gmail.com>
Date:   Tue Apr 21 18:49:40 2026 +0100

    ext/mysqli: Throw error when mysql_stmt_data_seek cannot be executed (#10419)

diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index ccb1da6af73..c667712f85f 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1488,6 +1488,15 @@ PHP_FUNCTION(mysqli_stmt_data_seek)

 	MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);

+	if (!stmt->stmt->data || !stmt->stmt->data->result || !stmt->stmt->data->result->stored_data) {
+		if (hasThis()) {
+			zend_throw_error(NULL, "mysqli_stmt::data_seek(): No result set associated with the statement");
+		} else {
+			zend_throw_error(NULL, "mysqli_stmt_data_seek(): No result set associated with the statement");
+		}
+		RETURN_THROWS();
+	}
+
 	mysql_stmt_data_seek(stmt->stmt, offset);
 }
 /* }}} */
diff --git a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
index a36daebc795..e4b913229cd 100644
--- a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
@@ -25,6 +25,11 @@
     if (true !== ($tmp = mysqli_stmt_execute($stmt)))
         printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);

+    try {
+        mysqli_stmt_data_seek($stmt, 1);
+    } catch (Error $exception) {
+        echo $exception->getMessage() . "\n";
+    }

     $id = null;
     if (!mysqli_stmt_bind_result($stmt, $id))
@@ -82,6 +87,7 @@
 ?>
 --EXPECT--
 mysqli_stmt object is not fully initialized
+mysqli_stmt_data_seek(): No result set associated with the statement
 int(3)
 int(1)
 int(1)