What are the possible causes of this error?

Source: Internet
Author: User
Why does this error occur when the local ecshop website is uploaded to the Internet? Strict Standards: Only variables shocould be passed by reference in lib_main.php on line 2661 local php is 5.2

The first row of this file is $ ext = end (explode ('.', $ tmp ));

$ Tmp = basename ($ tmp, ". $ ext"); what are the possible causes?


Reply to discussion (solution)

Strict Standards: Only variables shocould be passed by reference
Strict standard: only variables can be used here
$ Ext = end (explode ('.', $ tmp ));
Ying writing
$ T = $ ext = explode ('.', $ tmp );
$ Ext = end ($ t );
This is an error check that is available only after php 5.4.
In fact, php already provides more concise functions.
$ Ext = pathinfo ($ tmp, PATHINFO_EXTENSION );

The end parameter must be of the reference type and the reference type must be of the left value, as shown below:
Mixed end (array & $ array)
The function explode returns the right value and cannot be referenced.

Mixed end (array & $ array)

The end parameter is of the reference type.
An error occurs because explode does not return a variable.

In fact, you can change it.

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


Or

$ext = explode('.', $tmp);$ext = array_pop($ext);echo $ext;

This is only caused by the error check level.
This is not because the end function cannot accept the return value of the function.

Echo phpversion (), PHP_EOL; // Print the php code $ tmp = 'AAA. ext '; $ ext = @ end (explode ('. ', $ tmp); // block the error message echo $ ext; // output ext

Thank you for your enthusiastic answers.

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.