Support » Fixing WordPress » PHP Error preventing login, but site loads (partially)

  • Resolved cozbaldwin


    When trying to access /wp-admin/ in the browser, I’m getting:
    Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /***/wp-admin/includes/media.php on line 1244

    The site loads ok, but the sidebars are missing.

    Now, I haven’t done much recently to this site, so it must have happened during an upgrade of WP version or plugin. The theme files haven’t been touched, although I will say this is an old theme and most likely it’s age is the culprit somewhere.

    Here is the last 13 lines of media.php where the error is supposedly happening:

    $extra_rows = array();
    		if ( !empty( $field['errors'] ) )
    			foreach ( array_unique( (array) $field['errors'] ) as $error )
    				$extra_rows['error'][] = $error;
    		if ( !empty( $field['extra_rows'] ) )
    			foreach ( $field['extra_rows'] as $class => $rows )
    				foreach ( (array) $rows as $html )
    					$extra_rows[$class][] = $html;
    		foreach ( $extra_rows as $class => $rows )
    			foreach ( $rows as $html )
    				$item .= "\

    I’ve already tried changing the directory name of the theme via FTP hoping the site would switch to using twenty-eleven. But all that did was cause the site to not load at all.

    Kinda wondering what else I could do… Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Did you edit that file for some reason? Either you did not post the rest of that last line or it was edited out. I suggest replacing media.php with a fresh copy from 3.42 and see if that fixes the issue.

    Also, I highly recommend upgrading to a more current theme.

    I’m definitely gonna go with a new theme.

    But no, I made no edits to that page, which is why I didn’t think it necessary to re-upload files.

    But I see now they are vastly different. I updated the file and went deeper down the rabbit hole. The next error reads:
    Parse error: syntax error, unexpected $end in /***/wp-admin/includes/plugin.php on line 467

    Went to look there and found it, too, stopped abruptly on line 467.

    function is_plugin_active_for_network( $plugin ) {
    	if ( !is_multisite() )
    		return false;
    	$plugins = get_site_option( 'active_sitewide_plugins');
    	if ( isset($plugins[$plugin]) )

    Overwriting that allowed me to get to the login screen, but upon logging in, I was greeted with:
    Fatal error: Class ‘WP_Screen’ not found in /***/wp-admin/includes/deprecated.php on line 881

    But overwriting that does nothing. That file is up to date and here is line 875-882:

    function add_contextual_help( $screen, $help ) {
    	_deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' );
    	if ( is_string( $screen ) )
    		$screen = convert_to_screen( $screen );
    	WP_Screen::add_old_compat_help( $screen, $help );

    You can see that WP_Screen does exist there.

    I’m really not sure where the problem lies. My best suggestion would be to try a manual reinstallation. You should backup your site and database through your hosting control panel before you attempt this.

    Make certain not to delete your wp-content folder. The above instructions are pretty straightforward. Let me know.

    Yeah, i think that’s the only way to go now. I’ll try that soon and try to remember to document results here. Thanks for your time.

    Well that did it. Must have been a bad/incomplete upgrade when I last did it.
    However my sidebars are not being recognized anymore and that’s gotta be a theme thing so I’m SOL until I can get some time to customize a new theme up.

    Thanks again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Error preventing login, but site loads (partially)’ is closed to new replies.