Support » Fixing WordPress » Parse error: syntax error, unexpected end of file, expecting '}'

  • Resolved nathanfield

    (@nathanfield)


    Hello,

    I have recently (after a short hiatus) returned to my website (www.nathanfield.com.au) to find the following message: “Parse error: syntax error, unexpected end of file, expecting ‘}’ in /home/nathanfi/public_html/wp-includes/functions.php on line 3677”

    I have tried to add a ‘}’ to the end of line 3677, however this just gives me the same error message, minus “expecting ‘}'”.

    I am not aware of any change that I made that could cause this! Furthermore, I am not fluent in PHP. Line 3677 is:

    if ( $context && $extra_headers = apply_filters( "extra_{$co

Viewing 15 replies - 1 through 15 (of 15 total)
  • nathanfield

    (@nathanfield)

    Any help is much appreciated!

    Nathan

    Gemfruit

    (@gemfruit)

    Post the last 20 or so lines of functions.php for us to see.

    nathanfield

    (@nathanfield)

    Hi Gemfruit,

    The last 30 lines are:
    `
    /**
    * Retrieve metadata from a file.
    *
    * Searches for metadata in the first 8kiB of a file, such as a plugin or theme.
    * Each piece of metadata must be on its own line. Fields can not span multiple
    * lines, the value will get cut at the end of the first line.
    *
    * If the file data is not within that first 8kiB, then the author should correct
    * their plugin file and move the data headers to the top.
    *
    * @see http://codex.wordpress.org/File_Header
    *
    * @since 2.9.0
    * @param string $file Path to the file
    * @param array $default_headers List of headers, in the format array(‘HeaderKey’ => ‘Header Name’)
    * @param string $context If specified adds filter hook “extra_{$context}_headers”
    */
    function get_file_data( $file, $default_headers, $context = ” ) {
    // We don’t need to write to the file, so just open for reading.
    $fp = fopen( $file, ‘r’ );

    // Pull only the first 8kiB of the file in.
    $file_data = fread( $fp, 8192 );

    // PHP will close file handle, but we are good citizens.
    fclose( $fp );

    // Make sure we catch CR-only line endings.
    $file_data = str_replace( “\r”, “\n”, $file_data );

    if ( $context && $extra_headers = apply_filters( “extra_{$co`

    Thanks!

    vtxyzzy

    (@vtxyzzy)

    Please put the entire file in a pastebin, and post a link to it here.

    nathanfield

    (@nathanfield)

    Hi vtxyzzy,

    I’ve copied the entire file into a pastebin:

    http://pastebin.com/bWCDNJ3Y

    Thanks again for your help!

    Nathan

    There are many, many lines missing from the end of that file. Try uploading a fresh copy from whatever version of WordPress that you are using.

    Thanks vtxyzzy,

    Because I can’t gain access to my WordPress admin panel, how can I find out what version of WordPress I’m running?

    Also, where might I download the file/s?

    Thanks

    esmi

    (@esmi)

    Forum Moderator

    You need to examine the wp-options table in your database and locate the value for the option name db_version.

    Thanks esmi,

    I couldn’t find a file with that db_version line in it telling me explicitly what version I’m in.

    I instead found a file called version.php, which tells me:

    /**
     * The WordPress version string
     *
     * @global string $wp_version
     */
    $wp_version = '3.8';

    Does this sound right?

    Thanks

    esmi

    (@esmi)

    Forum Moderator

    I couldn’t find a file with that db_version line in it

    You need to examine the wp-options table in your database.

    Hi esmi,

    Where/how do I access this database? I searched online and found something called phpMyAdmin, but when I downloaded it, it’s just a bunch of php and other files.

    Please excuse my ignorance on how to do these sorts of things!

    Thanks

    esmi

    (@esmi)

    Forum Moderator

    You need to access the database on your hosts’ server using their copy of Phpmyadmin or whatever database management tool they provide. If necessary, ask your hoists for assistance.

    Thanks esmi, vtxyzzy and Gemfruit for your assistance.

    I just logged into CPanel and used Softaculous to update my WordPress version to 3.8.1, and it appears to have fixed the problem.

    Help!
    I’m completely locked out, can’t even delete and re upload theme, this just keeps popping up.
    Parse error: syntax error, unexpected ‘endif’ (T_ENDIF) in /home/jmwallace8/public_html/wp-includes/pluggable.php on line 1125

    esmi

    (@esmi)

    Forum Moderator

    If you require assistance then, as per the Forum Welcome, please post your own topic instead of tagging onto someone else’s topic.

    I am now closing this 3 month old topic as it references an older version of WordPress.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Parse error: syntax error, unexpected end of file, expecting '}'’ is closed to new replies.