Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128402 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 2A3E81A00BC for ; Wed, 6 Aug 2025 08:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1754469068; bh=gHve0m5prX0UXgy458vg9ZxVWkCRekuS4UFnu2KYCSQ=; h=From:Date:Subject:To:From; b=QY2Jqrc5Mhze+RJCGLBX8+HKJAL36bR5TFdbXhqASuP4ExSuifRKgiSmpV6GVJmVr kTak7P6J5BnnngG/BrBP1Ft/Ao64nDGPvMfQCNWLYAnjpd1LoRqsXXqIBQIc4lw0sa nd2jdTftPeecHMKBz6tcZ85pM9tQ9OW6Im8TlAFrJd12e0nJVwQIjODUFciJOcrgeg kHRHFTFzKdev2/4M6cSM6MaSVguyLmnCN1Y+fy3BkgLB+0SJNjA3ycPLfoIrYhnSIz NIRoUD9BXbveELv2sojm8crah9XCwoSBSRyRstMqIZIMIV196v2yrlg5vLLWuU6Q4A 3ProjKHf27LpA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 512D618003B for ; Wed, 6 Aug 2025 08:31:08 +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=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 ; Wed, 6 Aug 2025 08:31:08 +0000 (UTC) Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-61592ff5ebbso11152527a12.3 for ; Wed, 06 Aug 2025 01:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754469166; x=1755073966; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gHve0m5prX0UXgy458vg9ZxVWkCRekuS4UFnu2KYCSQ=; b=S5Eo772UCV1KnYJ3fEWeDSbi9zkU9QgFwlrHYEkp8cMM2jI/gWy5y/O83zdjG19syF 6VTeHkTgs6Fti/HUKlX72cdWCHA39IaO1nmDYGtvQzZ223RHMrMkSgW2Xbsoupdy9Bi5 ubOU3KW/CTjBa+SBOWv1vy4m1px0uVsgXyHRxlznCuMFgsOmFaN4z4PJ1GoQZ4ulmL3j dj7x+Q9GbOM5futr9tgF4gupGa5Oq/iypy9f0xKpv8UV5llPsIlUlvG0v7BY4slHnYe1 WR4XuDCaXBZsvmRjYlxW/u40tuSGSqO5QqVVw+gOqzvYY7S+XW6liyA3qlErWQLnZlMI +FQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754469166; x=1755073966; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gHve0m5prX0UXgy458vg9ZxVWkCRekuS4UFnu2KYCSQ=; b=Eae1iX1cgUNN0760lSUYSfU1WZALqeuAc6EUkdrKRPaxzudO92QGPMN3gJ3FMgnsTX PAqGyP200wjamuWM1P4l+zrAWMW8oQObKb0tG9UdF07f4QGMjylzDP3W60ItJ/7GYYh8 4C2dFU9vQGY2w7iJRnoQx+RixeKtRehq86BNiCHQaqakeD2ql5aKbGxO3FXW5pP2tXsV uhtLNvu22S/KoeB5k29DqteNzqveXcCM8XsNQazCfBK1S1cG3lgEQIF5IYbxuMD/86nQ /dVZYZsHTPZRroKx+m6kjfUY1lPlP/YbVCq6aztDumzKIeuk38r33q801rsiyp4nD7iG BKVQ== X-Gm-Message-State: AOJu0YznsxFG5DQLzvZ4Jw60ttBwvYZyMHVrtmPnPtJ7sANlJ4wFYmeD zbLj8eCwC3G7NYkK6MPqvIH6u5KngsPDj9+yChepb+agS99vjdiCrzrSxi3p+M/59/SZcbCp3rT oY/q/bMGQC5EdVj9Ujpkov+LYWkVCcVOrEyNB X-Gm-Gg: ASbGnctYRONbyz7DYCwBjkx8FK0xWLQaeOTH58fe+P6kWqZ2LinJI3NOn8bvGpn34PM beU630se5sUn/SpNPo6JQeuWfXrd2/Lqg843yKUTH5qJZ/wN7C8Ff0EiL39OnapOKVZh41TZDaT rd5Ouu7cPvDkdVRkz1MJdpZszdjqr7ymHji+TYzcMG378Vr5I5EhT+QnWjxXNjBGDpYnF+SXB2C jvrWkhxuBNYBRymV9DHlrqLiBeh65+3Ng7uD5s74g== X-Google-Smtp-Source: AGHT+IHqgqlyb8i8IT3gL1jTNnnIKCe0kSTCJF8JKpYxc5hANia41SeC5Oaj9YAaTqf9J27yZQSs1FQgUJl81N0uaz8= X-Received: by 2002:a05:6402:26cd:b0:611:f4b2:379c with SMTP id 4fb4d7f45d1cf-6179615eedemr1456518a12.20.1754469166122; Wed, 06 Aug 2025 01:32:46 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 6 Aug 2025 10:32:34 +0200 X-Gm-Features: Ac12FXzhFNWlN1NZd93xjcV8TT8LmGs1oS7uBqjgSdaR7BtL3sVdESdqf6SunkU Message-ID: Subject: [PHP-DEV] [DISCUSSION] Deprecating userland creation and cloning of __PHP_Incomplete_Class To: PHP internals list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: alex.daubois+php@gmail.com (Alexandre Daubois) Hello Internals, I would like to gather feedback on the proposal to deprecate userland creation and cloning of __PHP_Incomplete_Class objects. Here are the reasons I believe this deprecation would be beneficial: - __PHP_Incomplete_Class is intended to be an internal mechanism for handling incomplete object unserialization, not for direct userland manipulation; - This change would align with PHP's general direction of preventing misuse of internal classes; - Classes like Generator already prevent userland instantiation, making this change consistent with existing patterns; - No added-value on using this class in userland, stdClass does already the job if one wants to manipulate "incomplete" classes. Having stdClass and __PHP_Incomplete_Class could be misleading; - Prior to PHP 7.2, is_object() on such object returned false, showing how this is some kind of special case. The proposed deprecation would affect: - Direct instantiation: `new __PHP_Incomplete_Class()` - Cloning operations: `clone $incompleteClassInstance` Regarding the impact this would have, a search for =E2=80=9Cnew __PHP_Incomplete_Class=E2=80=9D on GitHub seems to show that it is mostly u= sed in Rector rules targeting PHP 7.2. It therefore seems to me to be minimal and worthwhile from the point of view of the robustness of the language. Adding "language: PHP" shows even less results, apart from test files from php-src. If this proposal receives interest, I would be happy to implement the deprecation warnings in the engine and prepare an RFC if required. Unless the change is actually uncontroversial? It seems to me, but I'm looking forward to your thoughts and feedback. Best, Alexandre Daubois