Fatal error: Call-time pass-by-reference has been removed, passbyreference

Source: Internet
Author: User

Fatal error: Call-time pass-by-reference has been removed, passbyreference

The following code reports an error: Fatal error: Call-time pass-by-reference has been removed

Function myFunc ($ arg) {do something ...}

MyFunc (& $ arg); // Call myFunc

Or

Function myFunc (& $ arg) {do something ...}

MyFunc (& $ arg); // Call myFunc

 

Error analysis:
Allow_call_time_pass_reference boolean
Whether to issue a warning when the parameter is passed according to the reference when the function is called. This method is no longer supported in PHP/Zend versions. We recommend that you specify which parameters should be passed by reference in the function definition. We encourage you to disable this option and ensure that the script runs properly to ensure that the script can run in future versions (a warning will be reported every time you use this feature ).

It is not recommended to PASS Parameters by reference during function calling because it affects code cleanliness. If the parameter of a function is not declared as a reference, the function can modify its parameter without writing the document. To avoid its side effects, it is best to specify the parameter only when the function declaration needs to be passed through reference.

Changelog for allow_call_time_pass_reference version description
5.4.0 removed from PHP.
5.3.0 Emits an E_DEPRECATED level error.
5.0.0 Deprecated, and generates an E_COMPILE_WARNING level error.



When a function is called, the reference parameter has been removed, that is, the function cannot be called by using function (& $.
Solution:
Check your php. ini configuration file, set the allow_call_time_pass_reference parameter to true, and restart the server.

In addition, this error may occur when the previous php code is upgraded to php 5.4:

When we use a function (or class) like this, an error is generated:

MyFunc (& $ arg); // Call myFunc

In fact, this is an error, but the previous error level is only Deprecated.

The correct method of use should be when the function is defined:

Function myFunc (& $ arg) {do something ...}

The parameter can be directly transferred during the call:

MyFunc ($ var); // Call myFunc




Fatal error: Call-time pass-by-reference has been removed in D: \ EasyPHP \ www \ Paixd \ DailyAuction \ Prcie

This means that the reference parameter has been removed during the call, that is, the function cannot be called through function (& $.

Solution:

Check your php. ini configuration file, set the allow_call_time_pass_reference parameter to true, and restart the server.

==============================================
In addition, this error may occur when the previous php code is upgraded to php 5.4:

When we use a function (or class) like this, an error is generated:

Foo (& $ var );

In fact, this is an error, but the previous error level is only Deprecated.

The correct method of use should be when the function is defined:

Function foo (& $ var ){
// Other code
}

The parameter can be directly transferred during the call: foo ($ var );

After logging on to bugfree, a line of words appears.

To the number of problematic rows, remove the & $ this variable and restart xampp or bugfree;
Or modify allow_call_time_pass_reference = On in php. ini.
 

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.