Changeset 64458
- Timestamp:
- 10/17/2026 11:21:34 PM (4 weeks ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/class-wpdb.php (modified) (1 diff)
-
tests/phpunit/tests/db.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wpdb.php
r64436 r64458 3952 3952 */ 3953 3953 protected function load_col_info() { 3954 if ( $this->col_info ) {3954 if ( $this->col_info || ! $this->result instanceof mysqli_result ) { 3955 3955 return; 3956 3956 } -
trunk/tests/phpunit/tests/db.php
r64434 r64458 584 584 $this->assertSame( array( $wpdb->users ), $wpdb->get_col_info( 'table' ) ); 585 585 $this->assertSame( $wpdb->users, $wpdb->get_col_info( 'table', 0 ) ); 586 } 587 588 /** 589 * @ticket 64130 590 * 591 * @covers wpdb::get_col_info 592 * 593 * @dataProvider data_get_col_info_without_result_set 594 * 595 * @param string $query Query that does not produce a result set. 596 */ 597 public function test_get_col_info_without_result_set( $query ) { 598 global $wpdb; 599 600 $suppress = $wpdb->suppress_errors( true ); 601 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 602 $wpdb->query( sprintf( $query, $wpdb->options ) ); 603 $wpdb->suppress_errors( $suppress ); 604 605 $this->assertNull( $wpdb->get_col_info(), 'get_col_info() should return null.' ); 606 $this->assertNull( $wpdb->col_info, 'The col_info property should be null.' ); 607 } 608 609 /** 610 * Data provider. 611 * 612 * @return array<string, string[]> 613 */ 614 public static function data_get_col_info_without_result_set() { 615 return array( 616 'failed query' => array( 'SELECT ID FROM table_that_does_not_exist' ), 617 'update query' => array( "UPDATE %s SET option_value = option_value WHERE option_name = 'blogname'" ), 618 'set query' => array( 'SET @wp_test_64130 = 1' ), 619 ); 586 620 } 587 621
Note:
See TracChangeset
for help on using the changeset viewer.