php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #78638 __PHP_Incomplete_Class should be final
Submitted: 2019-10-05 20:23 UTC Modified: 2019-12-27 11:26 UTC
From: fabien dot villepinte at gmail dot com Assigned: laruence (profile)
Status: Closed Package: *General Issues
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fabien dot villepinte at gmail dot com
New email:
PHP Version: OS:

 

 [2019-10-05 20:23 UTC] 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
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-05 20:51 UTC] fabien dot villepinte at gmail dot com
Please ignore the part about not being cloneable. I should have remove it.
 [2019-12-27 11:26 UTC] villfa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC