@@ -380,29 +380,6 @@ static bool really_register_bound_param(struct pdo_bound_param_data *param, pdo_
380380}
381381/* }}} */
382382
383- static bool pdo_stmt_do_next_rowset (pdo_stmt_t * stmt );
384-
385- static void pdo_stmt_invalidate_result (pdo_stmt_t * stmt )
386- {
387- if (stmt -> methods -> cursor_closer ) {
388- stmt -> methods -> cursor_closer (stmt );
389- } else {
390- do {
391- while (stmt -> methods -> fetcher (stmt , PDO_FETCH_ORI_NEXT , 0 ))
392- ;
393- if (!stmt -> methods -> next_rowset ) {
394- break ;
395- }
396-
397- if (!pdo_stmt_do_next_rowset (stmt )) {
398- break ;
399- }
400- } while (1 );
401- }
402-
403- stmt -> executed = 0 ;
404- }
405-
406383/* {{{ Execute a prepared statement, optionally binding parameters */
407384PHP_METHOD (PDOStatement , execute )
408385{
@@ -419,9 +396,10 @@ PHP_METHOD(PDOStatement, execute)
419396 RETURN_THROWS ();
420397 }
421398
422- if (stmt -> executed ) {
423- pdo_stmt_invalidate_result (stmt );
399+ if (stmt -> executed && stmt -> methods -> cursor_closer ) {
400+ stmt -> methods -> cursor_closer (stmt );
424401 }
402+ stmt -> execute_incomplete = 1 ;
425403 PDO_STMT_CLEAR_ERR ();
426404
427405 if (input_params ) {
@@ -488,6 +466,7 @@ PHP_METHOD(PDOStatement, execute)
488466 RETURN_FALSE ;
489467 }
490468 if (stmt -> methods -> executer (stmt )) {
469+ stmt -> execute_incomplete = 0 ;
491470 if (!stmt -> executed ) {
492471 /* this is the first execute */
493472
@@ -594,7 +573,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, enum pdo
594573
595574static bool do_fetch_common (pdo_stmt_t * stmt , enum pdo_fetch_orientation ori , zend_long offset ) /* {{{ */
596575{
597- if (!stmt -> executed ) {
576+ if (!stmt -> executed || stmt -> execute_incomplete ) {
598577 return false;
599578 }
600579
0 commit comments