Re: PHP 8.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
Didn't know or forgot this. After verification and if I'm correct, recursion during comparison appears when PHP compares 2 objects. Infinite recursion can appear when one of the objects compared references himself.
Example :
class RecursiveObject {
public $self;

public function __construct() {
$this->self = $this;
}
}

$obj1 = new RecursiveObject();
$obj2 = new RecursiveObject();

try {
$result = $obj1 == $obj2;
} catch (Error $e) {
echo "Une erreur a été capturée : " . $e->getMessage();
}
Which results in PHP 8.3:
PHP Fatal error:  Nesting level too deep - recursive dependency? in /var/www/html/api-spotify/public/test.php on line 14
PHP Stack trace:
PHP   1. {main}() /var/www/html/api-spotify/public/test.php:0
And in PHP 8.4 :
Une erreur a été capturée : Nesting level too deep - recursive dependency?

 Regards,
Vivien Goncalves
PHP Developer "Open To Work"

Le lun. 9 déc. 2024 à 03:20, JEFFRY KILLEN <jekillen@xxxxxxxxxxx> a écrit :
Hello; 

I do not see much activity on this list these days. Has it gone elsewhere mostly?

Anyhow I am looking at the online manual, specifically the deprecations.

I see a heading:

Recursion during comparison ¶

Encountering recursion during comparison now results in an Error exception instead of a E_ERROR fatal error.


I need some more information on the idea of Recursion during comparison:

I have written a recursive function that walks the file system and can be programed to respond to files and directories.

I its simplest form it just produces a file system mapping. But it can be used to delete, rename, and other operations.

Does recursion during comparison apply to this? (examples possibly?)

In truth I have a working function that does not normally produce E_ERROR. So I presume my question is partially answered.


Thank you for time and attention

JK


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux