WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-Scroll
Media uploader triggers Error - wp_debug = true, (10 posts)

  1. 2046
    Member
    Posted 1 year ago #

    Hello

    With the infinite scroll active and wp_debug = true, the media uploader after the image has been uploaded shows unexpected non-verbose Error.
    The Image is uploaded though.

    I have experienced same bug on one of my plugins with typo in the beginning of the php file. I have checked your phps but have not seen anything like that on first sight.

    http://wordpress.org/extend/plugins/infinite-scroll/

  2. isabisa
    Member
    Posted 1 year ago #

    Following. I am having this exact same issue.

  3. Veerle Verbert
    Member
    Posted 1 year ago #

    I get a notice:
    Notice: Undefined offset: 1 in .../wp-content/plugins/infinite-scroll/includes/presets.php on line 447

    could this be the one responsible for the media-ajax to fail?

  4. Veerle Verbert
    Member
    Posted 1 year ago #

    posted too soon: it was the killer for me.
    for now I put a quick extra check in presets.php (l447), seems to work fine:

    foreach ( $this->keys as $id => $key ) {
      if (array_key_exists($id,$line))
        $lineObj->$key = $line[ $id ];
    }
  5. Veerle Verbert
    Member
    Posted 1 year ago #

    & another one: line 90 in admin.php. put an extra check there to see if http_post_files exist & the media library is back in debug mode

  6. refreshingdesign
    Member
    Posted 11 months ago #

    Veerie - What exactly did you add to admin.php line 90 to fix this? Thanks!

  7. Veerle Verbert
    Member
    Posted 11 months ago #

    two extra checks: array_key_exists('HTTP_POST_FILES',$GLOBALS)

    if (array_key_exists('HTTP_POST_FILES',$GLOBALS)) {
    	$upload = $GLOBALS['HTTP_POST_FILES']['async-upload'];
    	$title = substr( $upload['name'], 0, strrpos( $upload['name'], '.' ) );
    	$id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type = '" . $upload['type'] . "' AND post_parent = '0' AND post_title = '$title' ORDER BY ID DESC LIMIT 1" );
    }

    and !isset($id) iso !$id

    if ( !isset($id))
    	return $args;

    just to stop the notices & get the media uploader working in debug

  8. refreshingdesign
    Member
    Posted 11 months ago #

    Shoot. It's still not working. When I upload an image I get "Error" // "An error occurred in the upload. Please try again later." I now have in admin.php from 88...

    //because we can't get the attachment ID at this point, try to pull it from the database
    			//look for the most recent parent-less attachment with same title and mime-type
    			if (array_key_exists('HTTP_POST_FILES',$GLOBALS)) {
    					$upload = $GLOBALS['HTTP_POST_FILES']['async-upload'];
    			$title = substr( $upload['name'], 0, strrpos( $upload['name'], '.' ) );
    				$id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type = '" . $upload['type'] . "' AND post_parent = '0' AND post_title = '$title' ORDER BY ID DESC LIMIT 1" );
    			}
    
    			//if for some reason we couldn't pull the ID, simply kick
    			//the user will just have to click insert to close the dialog
    			if ( !isset($id))
    				return $args;
    
    		}

    And in presets.php from 439...

    $presets = array();
    
    		//build preset objects and stuff into keyed array
    		foreach ( $data as &$line ) {
    
    			$lineObj = new stdClass;
    
    			foreach ( $this->keys as $id => $key )
    				if (array_key_exists($id,$line))
    				$lineObj->$key = $line[ $id ];
    
    			$presets[ $lineObj->theme ] = $lineObj;
    
    		}
    
    		return $presets;
    
    	}
  9. Veerle Verbert
    Member
    Posted 11 months ago #

    sure this is the debug-mode issue?
    sounds like there's something else going on (maybe it's a permissions issue)

    what errors do you get in debug mode? log the errors with this in your wp-config:
    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', false);

  10. refreshingdesign
    Member
    Posted 11 months ago #

    Thanks, Veerie! I guess my issue may have been a different one. If anyone is having trouble with the media upload error "an error occurred in the upload", delphiman has posted a solution here: http://wordpress.org/support/topic/conflict-with-uploading-image?replies=3#post-4666938

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic