Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122522 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 qa.php.net (Postfix) with ESMTPS id 443331AD8F6 for ; Tue, 27 Feb 2024 20:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1709065185; bh=pQ7WoYgQYjMhUSI8+Ng+O/6EaqniWJ/jR8hw+LY1+y4=; h=References:In-Reply-To:From:Date:Subject:To:From; b=kOPvO7Qu0CkrBnQj+orenKEus72FPMSjnx3qhVbihxZ2qcGztgJkQSt98wxIW704P 65BMbxK0dnKOA39e0/QB3jQRer/AcQeWoS7/uQho3K1+d933bgZ6IR6He3TtzGiFxo sjV12IUr3269YZ4TFh46XFPBhtRr5OUBSs2ZN9QouDTBQlFUGZ4JAD2vxb3gzOmdjT sU45H3Zak/on9/OH2zkQFpuRes+vGJOXRxuRIggn60wkIsOEEJ4+f4FBxcNaGOLOFH NylsbspbZkr3VbVUagh3hYIjVZOe+U7YpkJcYyx1SHCH7GeQnMxeRKs5SmTkAi4TG1 x7fF5vJRzFdQA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7AA0B181574 for ; Tue, 27 Feb 2024 20:19:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,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, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (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 ; Tue, 27 Feb 2024 20:19:44 +0000 (UTC) Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3c19e18470aso2118569b6e.1 for ; Tue, 27 Feb 2024 12:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709065174; x=1709669974; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2J32GaRHXAZVd/pGXT4g1Wu0QnkrsojAB8of5wZFfJ8=; b=ExalIDoYLBMsnfInqtrJKQu6zn3CrXsu+i36wKWowxkzP9CLmvfhmGTLo0MMZivhuS sjgbaLWEu3IDlgh2xKCLhTKMd/S+R1i3puMr+t1i90C0qsRNsafTRLLonvJ7x6l99jBA sZA8ehJzoUzzUrVAQm+pkcIDBrLqN9bhW5k8nQ9N7bxG5GuIeajDnNP3NVHDkdVF/rd8 8Fkf/kYgcFn1huPClGkaVFNFOSqRDCyoYnV5NU1NaBETR386659pgyi2h1IrbD0kjHnL egiFp/6Uj8X4A3DHvcoIsgiDYWGGPjhp0zxwNFuHWYZdGeNFhH6uRFa98pZ565+xKZUm +SlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709065174; x=1709669974; h=content-transfer-encoding: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=2J32GaRHXAZVd/pGXT4g1Wu0QnkrsojAB8of5wZFfJ8=; b=AWs523y5tkLZ5neahx27EkiNiSZEF4gUPRfPnxwK3k3B3Lh9y2EYo7PZWpOhSwy+dq m+tPUN4L0oKRs8P84D8G7hPWzInP30miHicAqdyrNSuuHw3fgPAnh7XT54i8KqiRWcrS Y2xwLfmj4WkievhOHb1iWVg+JCBj/oiXdpKNLEBCY2udf8FhkfUFgNsVn3L9lHf6WXAd rger797XtU6yATTqYtXX2Xh9jGZYaa3cyP94I/qV0rpHd+NuEF0kgLFrGfy476sZkeAk LnBYRoIK1YMWrT9Ru/0D2eI1LDo+8+INz8h92uFJl8802tTr7h7xWDb+s5RQ9VJXXgPn TH5w== X-Gm-Message-State: AOJu0YzGsoW/adjQWyuD3BMafqOGKPtrXGjaeQhNxO0TpTAPhaf0mY/G ldlHb2XE4jwjRctOVFj5OUHVOxVpduaKm0rT1EtXpGIuuD5cz/9KZdvdrOsDp7HFKuohT1jcwrY hi8aq0PDF2+Ue7x2Ocyv/INczG/uvI73RWsORNg== X-Google-Smtp-Source: AGHT+IHsPPj4m5pvf1gIgwu0KLvnrxf7sTboamwi7CMhHlLuakPVTDO7RMXrqv/pLC9LEmf1UN7eDFThc965tnFwHic= X-Received: by 2002:a05:6830:58:b0:6e4:8e99:5895 with SMTP id d24-20020a056830005800b006e48e995895mr2456275otp.25.1708808161845; Sat, 24 Feb 2024 12:56:01 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 24 Feb 2024 21:55:49 +0100 Message-ID: Subject: [PHP-DEV] Fwd: History of traits + inheritance To: internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: landers.robert@gmail.com (Robert Landers) ---------- Forwarded message --------- From: Robert Landers Date: Sat, Feb 24, 2024 at 9:20=E2=80=AFAM Subject: History of traits + inheritance To: internals I'm asking for a history lesson if anyone knows, as I couldn't find any relevant information in externals and it appears to have been this way for awhile, with a minor exception, which is the part I'm curious about. Consider the following code: abstract class A { abstract protected function test(); } class C extends A { protected function test() { return 'C'; } } class D extends A { public function prnt(A $a) { echo $a->test(); } protected function test() { return 'D'; } } $d =3D new D; $c =3D new C; $d->prnt($d); $d->prnt($c); This behaves exactly how you'd expect it to behave "DC" is printed on the screen. However, if we add a trait: trait E { protected function test() { return 'E'; } } and implement it: class B extends A { use E; } $d->prnt($b); We get the following fatal error: Call to protected method B::test() from scope D Except that in 5.4.7 - 5.4.10, the "expected" output is given: DCE To me, this breaks the whole idea usually given that "traits are fancy, compiler assisted copy-paste" since clearly it gives an error when trying to use it like that. However, I'm mostly curious as to what happened in 5.4.7 that "fixed" it and then was reverted after 5.4.10. There's nothing about it in the release notes for 5.4.11, and nothing about it in externals (that I could dig up). Another thing I'm curious about: is this intentional behavior or a bug that probably won't be fixed (or would only be fixed via an RFC)? Robert Landers Software Engineer Utrecht NL PS. bumping this because it didn't show up on externals so I can only assume something didn't work.