Req #78638 [Opn->Csd]: __PHP_Incomplete_Class should be final

From: Date: Fri, 27 Dec 2019 11:26:34 +0000
Subject: Req #78638 [Opn->Csd]: __PHP_Incomplete_Class should be final
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224551@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78638&edit=1 ID: 78638 Updated by: villfa@php.net Reported by: fabien dot villepinte at gmail dot com Summary: __PHP_Incomplete_Class should be final -Status: Open +Status: Closed Type: Feature/Change Request Package: *General Issues PHP Version: Irrelevant -Assigned To: +Assigned To: laruence Block user comment: N Private report: N New Comment: __PHP_Incomplete_Class is now final: http://git.php.net/?p=php-src.git;a=commit;h=b418f335d4a764c5d1d4ae59d6c1d0a0bd2550f4 Previous Comments: ------------------------------------------------------------------------ [2019-10-05 20:51:49] fabien dot villepinte at gmail dot com Please ignore the part about not being cloneable. I should have remove it. ------------------------------------------------------------------------ [2019-10-05 20:23:18] fabien dot villepinte at gmail dot com Description: ------------ __PHP_Incomplete_Class should be final and not cloneable. There is no meaning in letting the possibility to extend it. This change would be a BC break but it shouldn't impact anyone. Test script: --------------- <?php $c = new class('bar') extends __PHP_Incomplete_Class { public $foo; public function __construct($foo) { $this->foo = $foo; } }; var_dump($c); Expected result: ---------------- Fatal error: Class class@anonymous may not inherit from final class (__PHP_Incomplete_Class) in /in/Vl5Ep on line 3 Actual result: -------------- Notice: class@anonymous::__construct(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /in/Vl5Ep on line 7 object(class@anonymous)#1 (1) { ["foo"]=> NULL } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78638&edit=1

« previous php.bugs (#224551) next »