Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130267 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id C56DC1A00BC for ; Sat, 7 Mar 2026 21:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1772919449; bh=ov9HLUtg0cMJFpdrXl+QWfMsHhg7v2jjw9xk0gaEbqI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=W0g5kCpZKhF1FNyBy1gaKqKnrBX+iIOlQvPq/ItxXfAZx71AP1gP7MeeiDFRe8ukc k/ALpbNuYjKvLeyNxheBuH7kzIZQYYHlzaahzfXpKkZx2u1Ular+HBYLeMZLG2VDm3 Cp322VoM1AyXqlLDlDYUjTt+U3GyhPS0QX26Si+tJmabXJMXW7+8lrffE9CyvOrwgG AgBe9hQoxDfQn7tGBPMhUBwpyBjGUl0BROqHlE+pqj3st7m0M+s02s3feUZfujUvYv K+OSwvF5rw/8gH8fchQaUhEFNrW9OXQvTq5iZlmBHPldFUzUNrTZ4ckByI59i4krS/ pd3jrD3kUijHg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DF744180707 for ; Sat, 7 Mar 2026 21:37:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 7 Mar 2026 21:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1772919441; bh=K30E6fdNwKTM6Puub+6F0ETg+/fSQGdeZPzq2uB0TqQ=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=EzBcF6yFpbOU2cOkZ0cXd2D3sz6KdsngvKsFtIr0tOuVN3xhfxKT4QnQIuLAGykfa m/x3FCSrGj6uGHS8WGtcTvz1FZLHX8JsKvejk3p6PT4N7XG50tRr48kju/yUGDdChi ZO/8vpMQMp23F0ww62ATuTOHmNcDslHWNoeFv9RrqmLpAXJV7GhHt2GCehoBUyucOT NkRXodIcz6riVLxRinfcCLvzK9HcDx1L/SdddSNaiZoqRk1fk/vPNYHqwaogxFjtlo gH+hrtkA9Lk21mpWEBM7P1Ot6KfHaQJcgoMxKeUeG5ZkRYB8GS1nbnldHnLGcpaSR7 8Icbmj5cYd0ng== Message-ID: <382ac6a7-a426-4e24-b859-f9f57c19e8e4@bastelstu.be> Date: Sat, 7 Mar 2026 22:37:21 +0100 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] [RFC] Prevent instantiation and cloning of __PHP_Incomplete_Class To: Jordi Kroon , PHP Internals List References: <7b32daa6-620e-4563-85b5-d6d9c0804115@Spark> Content-Language: en-US In-Reply-To: <7b32daa6-620e-4563-85b5-d6d9c0804115@Spark> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 3/3/26 19:02, Jordi Kroon wrote: > I would like to propose a new RFC titled “Prevent instantiation and cloning of __PHP_Incomplete_Class”. > > RFC: https://wiki.php.net/rfc/deprecate-incomplete-class-instantiation > Implementation PR: https://github.com/php/php-src/pull/21325 > > This RFC proposes to disallow direct instantiation and cloning of the internal class __PHP_Incomplete_Class. I don't find the motivation particularly compelling. Yes, manually instantiating the class is not particularly useful, but it's also not harmful. Similarly for cloning: If the cloning operation works correctly (i.e. it returning a new object with the same state), then it is just behaving according to expectations. On the contrary, I would like to see fewer behavioral differences between internal classes and userland classes. A class that can only be instantiated by the engine without there being a good engine-related reason is yet another special case that users need to learn about. Best regards Tim Düsterhus PS: Unserialization for unknown classes should just throw an Exception.