Title: Parse error : unexpected T_STRING functions.php
Last modified: August 21, 2016

---

# Parse error : unexpected T_STRING functions.php

 *  Resolved [smiley543](https://wordpress.org/support/users/smiley543/)
 * (@smiley543)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/)
 * Hi, i am seeing the following message when i log on to my website [http://www.smilespreaders.org](http://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)

 *  [Karine](https://wordpress.org/support/users/ka-ri-ne/)
 * (@ka-ri-ne)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783656)
 * 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](https://wordpress.org/support/users/smiley543/)
 * (@smiley543)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783661)
 * 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?
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783663)
 * 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](https://wordpress.org/support/users/smiley543/)
 * (@smiley543)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783665)
 * [@seacoast](https://wordpress.org/support/users/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?
 *  [Karine](https://wordpress.org/support/users/ka-ri-ne/)
 * (@ka-ri-ne)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783668)
 * 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…
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783670)
 * > 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](https://wordpress.org/support/users/smiley543/)
 * (@smiley543)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783671)
 * [@karine](https://wordpress.org/support/users/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 – }
 *  [Karine](https://wordpress.org/support/users/ka-ri-ne/)
 * (@ka-ri-ne)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783673)
 * 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](https://wordpress.org/support/users/smiley543/)
 * (@smiley543)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783675)
 * 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](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783678)
 * > 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](https://wordpress.org/support/users/smiley543/)
 * (@smiley543)
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783682)
 * [@jan](https://wordpress.org/support/users/jan/) – My site’s at [http://www.smilespreaders.org](http://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](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [13 years ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3783721)
 * One way is to check your URL via Sucuri SiteCheck like so:
 * [http://sitecheck.sucuri.net/results/smilespreaders.org/](http://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.
 *  [alearango](https://wordpress.org/support/users/alearango/)
 * (@alearango)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3784003)
 * 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 [http://sepku.com](http://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.

## Tags

 * [parse-error](https://wordpress.org/support/topic-tag/parse-error/)
 * [T_STRING](https://wordpress.org/support/topic-tag/t_string/)
 * [wp-includes](https://wordpress.org/support/topic-tag/wp-includes/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 13 replies
 * 5 participants
 * Last reply from: [alearango](https://wordpress.org/support/users/alearango/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/parse-error-unexpected-t_string-functionsphp/#post-3784003)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
