Asked  7 Months ago    Answers:  5   Viewed   36 times

Getting these errors "Deprecated: Assigning the return value of new by reference is deprecated..."

While I know what deprecated function means, but I am not very clear that what PHP does to them? Still execute them as usual? So at this point for this function, does PHP silently assign memory location for the variable or still using reference pointer?

EDIT - thanks for the answers, I asked this question because we are using adodb_lite and the library has not corrected error.



Deperecated functions still exist and you get the warning. So they work as expected. However in a future version they might disappear.

That's the same for other deprecated language features which you sometimes get notices about. It's a way to signal changes to users which have code based on an older PHP version.

Normally the deprecated features get removed after some time, but it's not predictable how long this takes. I know of at least one case where a once deprecated feature was un-deprecated later on. However, I think that's exceptional.

So if you see these warnings, update the code. Most often the PHP documentation has more information why something has been deprecated and what to do. Most often it's an improvement (e.g. in security), so you really should deal with these warnings if you care about the code.

Edit: I think it's noteworthy in this context to look for strict standards notices PHP Manual as well. They are somewhat related because these notices are useful hints for changes in the language as well.

Enabling E_STRICT during development has some benefits. STRICT messages will help you to use the latest and greatest suggested method of coding, for example warn you about using deprecated functions.

(from the PHP Manual link above)

Wednesday, March 31, 2021
answered 7 Months ago

Addslashes is generally not good enough when dealing with multibyte encoded strings.

Wednesday, March 31, 2021
answered 7 Months ago

Code | Run Inspection by Name... -- search for "deprecated" and choose correct one.

enter image description here

This will work as long as new Symfony is already in the project (so that IDE knows what method/class/constant is now considered deprecated).

Wednesday, March 31, 2021
answered 7 Months ago

The convertErrorsToExceptions="false" configuration option only controls the conversion of E_ERROR to exceptions. A deprecation is represented as E_DEPRECATED, though.

A configuration option is missing for controlling the conversion of E_DEPRECATED to exceptions. This will be added in PHPUnit 6.2. This will not be backported to PHPUnit 4.8, the version of PHPUnit you are using, as that version has reached its end of life.

In your bootstrap script you can set PHPUnit_Framework_Error_Deprecated::$enabled = false;, though, which will disable the conversion of E_DEPRECATED to exceptions.

Wednesday, March 31, 2021
answered 7 Months ago

Please see the PHP Manual on Classes and Objects. $this refers to the object instance. Also see these questions:

  • What does the variable $this mean in PHP?
  • What is the meaning of $this

For array($this,'some_function') see the PHP manual on callbacks. In methods and functions that do accept callbacks, like call_user_func, it means call the method some_function on $this. See

  • How do I implement a callback in PHP?
  • What is a callback function and how do I use it with OOP

Marking this as CW because it's not meant as an answer but the reason for closevoting as duplicate

Sunday, August 29, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :