Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127923 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 C330F1A00BC for ; Sun, 6 Jul 2025 17:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751823965; bh=3BGEVBUpFgfWknAG2Tafuo/WjBvMduiSXn4ZSbfTBlg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=k6GmWQfyV9nlP5Dg17yugQ2yeP9hG5ft8Ty92tEebppVpOFOU6uj3nvshCpQXoDoN ffdmF8+rzHzKIR0ymGhKVMv0vCnS1AF/CeUsnVdJBmCZ4B2Fu6YDM5cJPw26GrQTx1 TeSXmcLtp/ld9UOelaSBEGkKQ8O0FZeHMptBhAkQ09Btscl+q/0GzVBdWLHZebWa0G xWhNSr/gKVHGIG6S2o5NoUGsGQ7jv5zGD3Hv5E0fNjeD2Q1ZI7zuc6+oTw46JC40oX /ghCvwCbsNKlD+bKpnLZyZgRRdsYh8/nYGdarmBFV6Z7EYCUVp1KM2fZpZfiWiXSng myTNknMQsynEA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B2298180386 for ; Sun, 6 Jul 2025 17:46:04 +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, HTML_MESSAGE,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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (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 ; Sun, 6 Jul 2025 17:46:04 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-e7d9d480e6cso1700437276.2 for ; Sun, 06 Jul 2025 10:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751824075; x=1752428875; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3BGEVBUpFgfWknAG2Tafuo/WjBvMduiSXn4ZSbfTBlg=; b=P7NSd922AkhuSEN/NtGk20jAPi2wk27cKhgVKqtSQ8q4huBVrVWeMPaE2Y8o7EQHKn 6ppddd9Vqf1dMcDbvhfNIktFv9sx3G1/Cz8bTv6lj7ee4tn/ryircDS0ohUNIszdR/Rc FycwQQwfeISCLFdLjgttrAJ80TtoEOi9ut17QM48v9GW7uH3aAikHjcW9khq7Qy94SSK Egw/LZFdC0nSRHta5il0alaV3nNRc1S96tjpUREndLBCgvCz8vHkHL1oQE2LaCFTo3Cw GV0PKe16D0IWSXuQ56EJreTiphQ37sYgd+vt6x16KWIj9H4T6ez5LK4ZOUBzX3eieSMq 77ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751824075; x=1752428875; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3BGEVBUpFgfWknAG2Tafuo/WjBvMduiSXn4ZSbfTBlg=; b=K+hwddcKTQ87hQpVe8iY8nSG5TP1sXJEYdmyU/JqmG1T5yk6oh58mtGWxbz1Uzvyql 9wwDQyvwCVoozUwcP4kEcQwFZwIdSmaydM6TIwNHtLi92VJNPRMJs5exn1nvkUUXGjv3 t9ONSCya9LcTeHzcjOS+RxCiGwPnc2dRaGGo7wt7lZSn3UWWnL0fVm3dNs0U/uRLp5CW CdAq/JRxAE2J/YmJe0NcjdbVhwDjyJW5IU/cjzufGqP2d+TIfZpvjn8xU16VEmuH5G4x h6yRyPp4r8fFKrJDHH9aAMmOOcOIWk/kdRP4cd2P5t7tHkcR/2Crv4svY6fNUGS3ljVE /lNQ== X-Gm-Message-State: AOJu0Yzb5ohAfBgeGmnXw1Xsri7i1obBsfVqhv/yJ+K4NvRmGcLV9Pzv ZzuLBow+WR68GOSusXLgBkEmbaBsiBczpTO3hDNq2kL3wGEFeazFCPjIFr84ZEihe/BgDC8GG4p ZJ9uAZREFM/DLWZbMcI/qiqQ8X4gF4Is= X-Gm-Gg: ASbGncv8br8XMIGoMb+Yfl4I19QFfjPdR6cx4pFxV+9mCtPClwWlLy6f6RWieXjmnu+ zHDaorYwjJVakY/Xkf2vZ7WTTYRTN7zb8e4XEZDzwekPZK2KEx5FCyBNG2rM1rmOaWZFZuMbadc +ntuBKuGKQ0BL/qA8R2FYWO81T62B1+KHVNOAnr67jIU5QWek75eU1bBGEiksBEJt78iaZJXNmH 7w= X-Google-Smtp-Source: AGHT+IEpB81Nb+MEcpmoq5Ev5uHICNd3Uzcql8leAxkahLMYJlPuiLpfa6P7kfSfltZfpkKE53ACxLeuXktouXPYjVA= X-Received: by 2002:a05:6902:72c:b0:e84:27a0:6adb with SMTP id 3f1490d57ef6-e89a0d03b96mr9049571276.46.1751824074734; Sun, 06 Jul 2025 10:47:54 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <1454d4c5-ab45-4522-b1c5-a418bdcbb532@bastelstu.be> In-Reply-To: <1454d4c5-ab45-4522-b1c5-a418bdcbb532@bastelstu.be> Date: Sun, 6 Jul 2025 10:47:27 -0700 X-Gm-Features: Ac12FXy-WGuMW2uQOKNlRTSLGwwp_wIJ1l2ay7kAqm9buxAYmIUR0U5D8eMtk2E Message-ID: Subject: Re: [PHP-DEV] Re: [RFC] [Discussion] #[\DelayedTargetValidation] attribute To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: php internals Content-Type: multipart/alternative; boundary="000000000000af09b30639465383" From: daniel.e.scherzer@gmail.com (Daniel Scherzer) --000000000000af09b30639465383 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jul 6, 2025 at 5:48=E2=80=AFAM Tim D=C3=BCsterhus wrote: > Hi > > On 7/5/25 00:49, Daniel Scherzer wrote: > > If there is no further feedback, I intend to start a vote in a few days= . > > Looking at your #[\Deprecated] for traits RFC > (https://externals.io/message/127912): > > How will #[\DelayedTargetValidation] interact with the `validator` of > `zend_internal_attribute`? Would applying #[\DelayedTargetValidation] + > #[\Deprecated] on a regular class error or not? > > Best regards > Tim D=C3=BCsterhus > For validators, an extra flag is passed to the validator to indicate if target validation should be disabled, in which case the errors about targeting the wrong type of thing (e.g. a non-trait in the case of #[\Deprecated]) are suppressed until runtime as well. Thanks for pointing this out - I actually hadn't done this properly, fixed it now - take a look at the "errors_from_validator.phpt" and "validator_success.phpt" test cases in the PR. The reasoning here is exactly the same - validators are used to verify that an attribute is being used on things that are appropriate, just like targets. While the only current (non-zend_test) validator is for dynamic properties, and it is less likely that there will be a future where the validator accepts more things, we shouldn't assume that things will never change, e.g. I wouldn't object to allowing #[\AllowDynamicProperties] for read-only classes. But this will also set the stage for the #[\Deprecated] validator - that validator will enforce that a zend_class_entry is for a trait, but if validation is delayed then it will allow using #[\Deprecated] on interfaces or classes and the error being delaying until runtime. -Daniel --000000000000af09b30639465383 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Jul 6, 2025 at 5:48=E2=80=AFAM Ti= m D=C3=BCsterhus <tim@bastelstu.be> wrote:
Hi

On 7/5/25 00:49, Daniel Scherzer wrote:
> If there is no further feedback, I intend to start a vote in a few day= s.

Looking at your #[\Deprecated] for traits RFC
(
https://externals.io/message/127912):

How will #[\DelayedTargetValidation] interact with the `validator` of
`zend_internal_attribute`? Would applying #[\DelayedTargetValidation] + #[\Deprecated] on a regular class error or not?

Best regards
Tim D=C3=BCsterhus


For v= alidators, an extra flag is passed to the validator to indicate if target v= alidation should be disabled, in which case the errors about targeting the = wrong type of thing (e.g. a non-trait in the case of #[\Deprecated]) are su= ppressed until runtime as well. Thanks for pointing this out - I actually h= adn't done this properly, fixed it now - take a look at the "error= s_from_validator.phpt" and "validator_success.phpt" test cas= es in the PR.

The reasoning here is exactly=C2=A0t= he same - validators are used to verify that an attribute is being used on = things that are appropriate, just like targets. While the only current (non= -zend_test) validator is for dynamic properties, and it is less likely that= there will be a future where the validator accepts more things, we shouldn= 't assume that things will never change, e.g. I wouldn't object to = allowing #[\AllowDynamicProperties] for read-only classes. But this will al= so set the stage for the #[\Deprecated] validator - that validator will enf= orce that a zend_class_entry is for a trait, but if validation is delayed t= hen it will allow using #[\Deprecated] on interfaces or classes and the err= or being delaying until runtime.

-Daniel
--000000000000af09b30639465383--