• Resolved smiley543

    (@smiley543)


    Hi, i am seeing the following message when i log on to my website https://www.smilespreaders.org

    Parse error: syntax error, unexpected T_STRING in /home/content/69/7786769/html/smilespreaders/wp-includes/functions.php on line 3742

    Any assistance will be appreciated.

    Line 3742 corresponds to }turn bool true|false )

    The rest of the code –

    /**
     * Test if the current device has the capability to upload files.
     *
     * @since 3.4.0
     * @access private
     *
     * @return bool true|false
     */
    
    function _device_can_upload() {
    	if ( ! wp_is_mobile() )
    		return true;
    
    	$ua = $_SERVER['HTTP_USER_AGENT'];
    
    	if ( strpos($ua, 'iPhone') !== false
    		|| strpos($ua, 'iPad') !== false
    		|| strpos($ua, 'iPod') !== false ) {
    			return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
    	} else {
    		return true;
    	}
    }turn bool true|false
     */
    
    function _device_can_upload() {
    	if ( ! wp_is_mobile() )
    		return true;
    
    	$ua = $_SERVER['HTTP_USER_AGENT'];
    
    	if ( strpos($ua, 'iPhone') !== false
    		|| strpos($ua, 'iPad') !== false
    		|| strpos($ua, 'iPod') !== false ) {
    			return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
    	} else {
    		return true;
    	}
    }

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hi, you seem to have pasted the code to detect upload capability twice in your functions.php and this part:

    turn bool true|false
     */

    is causing the error.

    Thread Starter smiley543

    (@smiley543)

    Actually i didn’t do anything with the code, the website was functioning nicely till one day this error started showing up. Now if this part is causing the error, what should i do to rectify it?

    Since I am not seeing this:

    function _device_can_upload() {

    On that line, and since I do not see:

    }turn bool true|false
     */

    at all, we have two options:

    1. Did you edit that file? If so, you should never edit core files.
    2. If you did not, then your site may have been compromised. Try to upload (FTP) an unedited wp-includes/functions.php from version of WP you have installed.

    Thread Starter smiley543

    (@smiley543)

    @seacoast Web Design Member – Nah, i didn’t edit the file, in which case it seems the site has been compromised. Could you please let me know how i can upload just the wp-includes/functions.php from my version of WP. Does it have to do something with the theme as well?

    The error message is quite clear, the line 3742 on your functions.php file has a syntax error. You need to delete this part:

    turn bool true|false
     */

    It doesn’t mean anything and seems out of nowhere between two php functions (_device_can_upload()) and it is also strange that this function is appearing twice in your functions.php…

    Could you please let me know how i can upload just the wp-includes/functions.php from my version of WP

    Please navigate to yoursite.com/readme.html – this will tell you the version – this file will display regardless of a PHP issue.

    Second, download that version of WordPress. Extract the files.

    Third, using an FTP tool such as FileZilla or your host provided file management tool, rename the file wp-includes/functions.php to wp-includes/do-not-use-this-functions.php and then upload wp-includes/functions.php. Test site.

    Thread Starter smiley543

    (@smiley543)

    @karine – Tried what you said, now it says –

    Fatal error: Cannot redeclare _device_can_upload() (previously declared in /home/content/69/7786769/html/smilespreaders/wp-includes/functions.php:3730) in /home/content/69/7786769/html/smilespreaders/wp-includes/functions.php on line 3757

    Line 3730 – if ( ! wp_is_mobile() )

    Line 3757 – }

    You have the function twice in functions.php

    Delete one instance of _device_can_upload() :

    function _device_can_upload() {
    	if ( ! wp_is_mobile() )
    		return true;
    
    	$ua = $_SERVER['HTTP_USER_AGENT'];
    
    	if ( strpos($ua, 'iPhone') !== false
    		|| strpos($ua, 'iPad') !== false
    		|| strpos($ua, 'iPod') !== false ) {
    			return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
    	} else {
    		return true;
    	}
    }
    Thread Starter smiley543

    (@smiley543)

    PHEW! Thanks a Gazilllion Karine!! It worked! Site’s finally back up after many days ??

    Thanks to you too Seacoast Web Design ??

    I am smiling again ??

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Nah, i didn’t edit the file, in which case it seems the site has been compromised. Could you please let me know how i can upload just the wp-includes/functions.php from my version of WP.

    Can you share a link? If that one file was compromised then just replacing it will not work for long if at all. Especially if your site has been compromised.

    Thread Starter smiley543

    (@smiley543)

    @jan – My site’s at https://www.smilespreaders.org , its working now . What will be a good way to know if it has been compromised and what will be a good corrective action?

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    One way is to check your URL via Sucuri SiteCheck like so:

    https://sitecheck.sucuri.net/results/smilespreaders.org/

    Which often picks things up. Except for running and older version of WordPress (3.4.1) your site looks OK via that site.

    Hi all, my 3 sites are getting that error as well, what I was doing was replaicing the functions.php file, but it stays online for a couple of hours or a day. I run the sucuri test, and tells me I have a malware. How can I fix all this mess.

    my site is https://sepku.com

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Parse error : unexpected T_STRING functions.php’ is closed to new replies.