What could be the cause of the mistake?

Source: Internet
Author: User
Locally installed Ecshop website upload this error Strict standards:only variables should be passed by reference in lib_main.php on line 2661 local PHP is 5 .2 of

The 2661 lines of this file are $ext = end (Explode ('. ', $tmp));

$tmp = basename ($tmp, ". $ext"); What may be the reason for asking for advice


Reply to discussion (solution)

Strict standards:only variables should be passed by reference
Strict criteria: This can only be a variable
$ext = End (Explode ('. ', $tmp));
Should write
$t = $ext = Explode ('. ', $tmp);
$ext = End ($t);
This is a bug check after PHP 5.4.
In fact, PHP has already provided a more concise function
$ext = PathInfo ($tmp, pathinfo_extension);

The parameter required by end is a reference type, and the reference type must be an lvalue, as follows
Mixed End (array & $array)
The function explode returns the right value, which is not a reference.

Mixed End (array & $array)

The argument in end is a reference type.
The explode returned is not a variable, so an error occurred.

In fact, a change can be.

$ext = substr ($tmp, Strrpos ($tmp, '. ') +1);


Or

$ext = Explode ('. ', $tmp); $ext = Array_pop ($ext); Echo $ext;

Again, this is just the error-checking level.
Not the End function cannot accept the return value of a function

Echo phpversion (), Php_eol; Print out PHP with this number $tmp = ' aaa.ext '; $ext = @end (Explode ('. ', $tmp)); Block out error messages echo $ext; Output ext

Thank you for your enthusiastic reply.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.