Php Syntax Error Unexpected T_return Expecting T_function
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or syntax error unexpected 'return' (t_return) laravel posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
Parse Error: Syntax Error, Unexpected 'return' (t_return)
Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up unexpected T_RETURN, expecting T_FUNCTION when installing apc up vote 0 down vote favorite I am trying to install apc with command yum install apc it's giving me following error Parse error: syntax error, unexpected T_RETURN, expecting T_FUNCTION in /usr/local/lib/php/Archive/Tar.php on line 251 what could be the reason ? php pecl share|improve this question asked Feb 12 '10 at 6:28 ak. 111 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote In usr/local/lib/php/Archive/Tar.php, there is some code like this: class someClass{ function something(){ } return $x; } around line 251. A return statement is outside of a function, and because there cannot be any commands besides function declarations outside of a function that is in a class, it is causing an error If this is a APC error, you will want to contact the distributor, as they might be providing a bad copy of source code to more people that you. If this is your code, you might want to fix it. share|improve this answer answered Feb 12 '10 at 6:33 Tyler Carter 39.8k1895131 add a comment| up vote 0 down vote That's a PHP error, for a piece of software. Without the PHP code it would be difficult to solve the problem. Contact the package maintainer for the distro of Linux you are using and ask them to solve the problem, because StackOverflow probably isn't the best place for it ... share|improve this answer answered Feb 12 '10 at 6:33 jsnfwlr 1,6451115 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged php pecl or ask your own question. asked 6 years ago viewed 2705 times active 6 years ago Related 4PHP Version 5.2.14 / Parse error: syntax error, unexpected T_FUNCTION, expecting ')'52sudo pecl install apc returns error0unexpected > T_STRING, expecting T_OLD_FUNCTION or > T_FUNCTION or T
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected 'return' (T_RETURN) up vote -2 down vote favorite I am having an issue with accessing http://stackoverflow.com/questions/2250044/unexpected-t-return-expecting-t-function-when-installing-apc my WP-Admin on my Wordpress site. I keep getting this message: "Parse error: syntax error, unexpected 'return' (T_RETURN) in /home/rugguru/public_html/wp-includes/pluggable.php on line 1173". Any solutions? Below is the code on line 1173. $status = apply_filters( 'wp_redirect_status', $status, $location ); if ( ! $location ) return false; $location = wp_sanitize_redirect($location); if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' ) status_header($status); // This causes problems on IIS and some FastCGI setups header("Location: $location", true, $status) return true; http://stackoverflow.com/questions/26980104/parse-error-syntax-error-unexpected-return-t-return } endif; php wordpress share|improve this question edited Nov 17 '14 at 19:30 rici 104k1181136 asked Nov 17 '14 at 19:11 TroyMcClure 84 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote Your header line is missing a semi-colon. It may not be the line producing the error, but I'd start with that :) header("Location: $location", true, $status); Here's what I meant in the comments, about the if statement if ( ! $location ) return false; $location = wp_sanitize_redirect($location); if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' ): // note the colon status_header($status); // This causes problems on IIS and some FastCGI setups header("Location: $location", true, $status); return true; endif; // no } necessary or you could do this if ( ! $location ) return false; $location = wp_sanitize_redirect($location); if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' ) { status_header($status); // This causes problems on IIS and some FastCGI setups header("Location: $location", true, $status); return true; } if neither of these are what you are aiming for, I can only assume the endif belongs to another if statement outside of the scope of code you included... share|improve this answer edited Nov 17 '14 at 22:26 answered Nov 17 '14 at 19:14 Dale 16418 Thanks for the response @Dale. Still yielding the same res
Apparel forum Discussions forum Forum record_voice_over Laracasts Podcast forum Laravel Podcast Forum General syntax error, unexpected 'return' (T_RETURN), expecting ';' or '{' syntax https://laracasts.com/discuss/channels/general-discussion/syntax-error-unexpected-return-t-return-expecting-or?page=1 error, unexpected 'return' (T_RETURN), expecting ';' or '{' webdevdea — 2 years ago I am getting this error Symfony\Component\Debug\Exception\FatalErrorException …/app/controllers/TasksController.php13 The link to the code.. https://github.com/webdevdea/learningLaravel Best http://www.compdigitec.com/labs/2008/07/19/stopping-syntax-error-expecting-t_function/ Answer — Thread Owner's Choice school danharper — 2 years ago https://github.com/webdevdea/learningLaravel/blob/master/app/views/home.blade.php#L44
‘;', expecting T_FUNCTION By admin | July 19, 2008 If you've ever been stumped by "Parse error: syntax error, unexpected ‘;', expecting T_FUNCTION", you will know that this is a very difficult bug to track. Fortunately, we have found the error for you. This error message is very misleading, because your actual problem is that you have an extra semi-colon at the end of your functions, like the one below (see line 12): a = 'Hello World!'; }; # <-- That one }; ?> Now, the above code looks good, but when you try to run it it PHP spits out the following parse error: Parse error: syntax error, unexpected ‘;', expecting T_FUNCTION in *.php on line * So, to fix it, simply remove the offending semi-colon at the end of your functions. Hope this helped anyone who got stuck with this misleading PHP error. If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles! Topics: PHP | 20 Comments »
20 Responses to "Stopping syntax error, unexpected ‘;', expecting T_FUNCTION" egodi Says: August 27th, 2009 at 1:48 pm mine is PHP Parse error: syntax error, unexpected $end, expecting T_FUNCTION in C:\\\test\file.php on line 86 Gregor Says: September 26th, 2009 at 4:15 am Parse error: syntax error, unexpected ‘;', expecting T_FUNCTION on lin 519. The line 519 is just ?> what can I do? admin Says: September 27th, 2009 at 3:48 pm @Gregor: Did you by accident put in an extra semi-colon somewhere in your code before the "?>"? Gregor Says: September 28th, 2009 at 5:22 am I checked the whole php file, no ; before ?>. Is it possible to send you the (searchajax).php file? This are some of the lines of the code: ?> (<- line 519) Asdf Says: November 11th, 2009 at 2:01 pm Someone said "Parse error: syntax error, unexpected ‘;’, expecting T_FUNCTION on lin 519. The line 519 is just ?>" The same error to me. It was a } missing at the end, just before ?>. It was something like.. It was a deletion er