WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] ERROR AFTER UPDATE Version 3.5 (3 posts)

  1. starsuporte
    Member
    Posted 1 year ago #

    After the update is being displayed this message:

    ing: Missing argument 2 for wpdb::prepare(), called in /home/XXXXXX/public_html/wp-content/themes/artemis_tg/plugins/post-types-order/post-types-order.php on line 243 and defined in /home/XXXXXX/public_html/wp-includes/wp-db.php on line 990

    I would like to disable this message.

    There is already a page in the forum with the explanation, but it does not match my site.

    Código do arquivo wp-db.php:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    function prepare( $query, $args ) {
    		if ( is_null( $query ) )
    			return;
    
    		$args = func_get_args();
    		array_shift( $args );
    		// If args were passed as an array (as in vsprintf), move them up
    		if ( isset( $args[0] ) && is_array($args[0]) )
    			$args = $args[0];
    		$query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
    		$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
    		$query = preg_replace( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware
    		$query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
    		array_walk( $args, array( $this, 'escape_by_ref' ) );
    		return @vsprintf( $query, $args );
    	}
    
    	/**
    	 * Print SQL/DB error.
    	 *
    	 * @since 0.71
    	 * @global array $EZSQL_ERROR Stores error information of query and error string
    	 *
    	 * @param string $str The error to display
    	 * @return bool False if the showing of errors is disabled.
    	 */
    	function print_error( $str = '' ) {
    		global $EZSQL_ERROR;
    
    		if ( !$str )
    			$str = mysql_error( $this->dbh );
    		$EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str );
    
    		if ( $this->suppress_errors )
    			return false;
    
    		wp_load_translations_early();
    
    		if ( $caller = $this->get_caller() )
    			$error_str = sprintf( __( 'WordPress database error %1$s for query %2$s made by %3$s' ), $str, $this->last_query, $caller );
    		else
    			$error_str = sprintf( __( 'WordPress database error %1$s for query %2$s' ), $str, $this->last_query );
    
    		error_log( $error_str );
    
    		// Are we showing errors?
    		if ( ! $this->show_errors )
    			return false;
    
    		// If there is an error then take note of it
    		if ( is_multisite() ) {
    			$msg = "WordPress database error: [$str]\n{$this->last_query}\n";
    			if ( defined( 'ERRORLOGFILE' ) )
    				error_log( $msg, 3, ERRORLOGFILE );
    			if ( defined( 'DIEONDBERROR' ) )
    				wp_die( $msg );
    		} else {
    			$str   = htmlspecialchars( $str, ENT_QUOTES );
    			$query = htmlspecialchars( $this->last_query, ENT_QUOTES );
    
    			print "<div id='error'>
    			<p class='wpdberror'><strong>WordPress database error:</strong> [$str]
    			<code>$query</code></p>
    			</div>";
    		}
    	}
    
    	/**
    	 * Enables showing of database errors.
    	 *
    	 * This function should be used only to enable showing of errors.
    	 * wpdb::hide_errors() should be used instead for hiding of errors. However,
    	 * this function can be used to enable and disable showing of database
    	 * errors.
    	 *
    	 * @since 0.71
    	 * @see wpdb::hide_errors()
    	 *
    	 * @param bool $show Whether to show or hide errors
    	 * @return bool Old value for showing errors.
    	 */
    	function show_errors( $show = true ) {
    		$errors = $this->show_errors;
    		$this->show_errors = $show;
    		return $errors;
    	}
    
    	/**
    	 * Disables showing of database errors.
    	 *
    	 * By default database errors are not shown.
    	 *
    	 * @since 0.71
    	 * @see wpdb::show_errors()
    	 *
    	 * @return bool Whether showing of errors was active
    	 */
    	function hide_errors() {
    		$show = $this->show_errors;
    		$this->show_errors = false;
    		return $show;
    	}
    
    	/**
    	 * Whether to suppress database errors.
    	 *
    	 * By default database errors are suppressed, with a simple
    	 * call to this function they can be enabled.
    	 *
    	 * @since 2.5.0
    	 * @see wpdb::hide_errors()
    	 * @param bool $suppress Optional. New value. Defaults to true.
    	 * @return bool Old value
    	 */
    	function suppress_errors( $suppress = true ) {
    		$errors = $this->suppress_errors;
    		$this->suppress_errors = (bool) $suppress;
    		return $errors;
    	}

    Thanks to everyone who can help!

    Thank you!

  2. Whatever you do, do not make any changes to that wp-includes/wp-db.php as you'll be extremely sorry if you do. ;)

    Missing argument 2 for wpdb::prepare(), called in /home/XXXXXX/public_html/wp-content/themes/artemis_tg/plugins/post-types-order/post-types-order.php on line 243

    From your error message it looks like the Post Types Order plugin on your WordPress installation is the cause of that.

    http://wordpress.org/extend/plugins/post-types-order/

    If you are not doing so please make sure you are running the latest version of that plugin 1.5.7. If you are running the latest version then please reach out to the plugin author and give them this link.

    http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/

    You may also want to temporarily turn off PHP's display errors setting as explained in that link.

  3. starsuporte
    Member
    Posted 1 year ago #

    Problem solved!

    insert this code at the beginning of the file wp-config.php:
    @ini_set('display_errors', 0);

    the mesagem been disabled!

    Thank you!

    GOD bless you!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.