Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122782 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 0703B1A009C for ; Thu, 28 Mar 2024 02:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1711593012; bh=xFSN34m4MdBYMUbUMP5je/6qhrr6dX2X5uy315aBgZA=; h=From:Date:Subject:To:From; b=BkjShOF28xrxQP1khGCP5vkTfkU+gNs4n7wi7VlCwV98rpH2+fMAvKxdDhGf8cBTN APZEb8I9lemRm5qdPHQtKbAi/BWqw1onS6jctthGCecTUkv5e59f/wTLupI1e7m9f1 A3x48QcHg3GSBcdLNenrrx4ZDxoM2viWseYoomA1+r8tvwnvoOM42XJoj1hv8m/avR svNAlx4CyIsvjbuGV3HfG3skA+1r7gsuMdPFH6d9dLYijiZFao1GSguYVA5pC7p+XT XqSlp25WzLjvV/FfAVf0UZ53oUFQKd7yB0Jclaw2JCVoJc0J3q8MxJ5moa+1jFsUL+ a7BBd4qLcnXsA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6A35D18004E for ; Thu, 28 Mar 2024 02:30:12 +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, HTML_MESSAGE,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-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (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 ; Thu, 28 Mar 2024 02:30:12 +0000 (UTC) Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-dc6d8bd618eso462324276.3 for ; Wed, 27 Mar 2024 19:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711592986; x=1712197786; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=/BvCiEFUrOmo+qOVIFo0PRYzQlo40RLi/YMwTvnZrU8=; b=HTnxOX/lInIMFz6Rr8P/5quSyG2xcfLhHa7wRhQhfIqGXY0Xwa7IwuXQEBJj6zyvSP aV8FmxqCFnH/3wfHU/n+joHLGVqtwyjioLDr/8/B2tarasmbpI/LED3CXZ+ybY30OrtY JXWN6ofVcVeka7hDv7KTdYSaHpzIkz4rIV+LdYfdxYQL7caTvTSvnwfuPysiEJQEv6oE lwUJfXbmsaCuBnJXYo9qi6S5jzLLkcdp92qhEiJ86ftdVHbloEwFUUfGv4xgtUloDq/0 WaBU5XCiU11nG6T1d6zKWSv1Sb68RoOHs6ze046p+3oa8BGXevNy7KdHT/j0cUyVrjEM aDow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711592986; x=1712197786; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/BvCiEFUrOmo+qOVIFo0PRYzQlo40RLi/YMwTvnZrU8=; b=UdHZtGX7U1D38I/YULkiYC/eK6PPPcOYZTRafHcXMKfdHV1ZPCizjozrGo63fjb9cn vsnjkXZGGp7hqDTVj1eTeJiI/dzWe20ESnZxVOlH6ZY+QpkWpVbJ2oTzh7wwgdifpBCB Qg9wniWLxqyM+E74iAaqrQXxYXepgtQg6GzOt8tUz9i88gdw7r6coOTwV+6U2ImJ3Qw/ NPkMnVucm6wC2E25xH2TmnwRzeoavmqGtsxJluKcm6659O8LXhZhQ4Qv/LOMkUkq37Pv h6g4otC7dJlRTvmimqXI9gnP6yLpJUCXAT/rc3yCiOECGiSHxrGmOL2Y8OGVjyIFg47E M8mw== X-Gm-Message-State: AOJu0Ywy0z10PRuSuG9/+9C582m5jK6NXrlbT3PTs6iYzP7LzVWKsiwq xkr+C9ondUkxPx6rXNNTsQFyn4s5ad5xHqmgg1NyQWfJybzH32p1XzaJN5+nbgLs9amTtPbijLb yzy5wDJH/Ikokmm6vXkjt2XOfxgj4TVdROWK80Urz X-Google-Smtp-Source: AGHT+IEuPiFZHRVFYYRi4izKJJq60pw0EwRFC4iAzD46K7WgrI2Rl5rQx/1GBFESPeQp1t3A2Y5nIm1GAHgQASkceOM= X-Received: by 2002:a25:868f:0:b0:dcc:4cdc:e98f with SMTP id z15-20020a25868f000000b00dcc4cdce98fmr1577566ybk.34.1711592986052; Wed, 27 Mar 2024 19:29:46 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Date: Thu, 28 Mar 2024 10:29:35 +0800 Message-ID: Subject: [PHP-DEV] [RFC idea introduce] The issue where the __callStatic magic method is not called when statically calling a public method. To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000ef0ed60614af4b95" From: daddyofsky@gmail.com (=?UTF-8?B?7ZWY64qY7JWE67aA7KeA?=) --000000000000ef0ed60614af4b95 Content-Type: text/plain; charset="UTF-8" Hi. I would like to register an RFC on the following issue. https://github.com/php/php-src/issues/13813 To summarize briefly, users expect that the `__callStatic` magic method will be called in all cases when a method is not static while using the `__callStatic`. However, in reality, if the method is public, the `__callStatic` magic method is not called, and an error still occurs. I would like to hear your opinions. I also hope someone can help with the RFC registration. -------------------------------------------------------- ```php
<= div class=3D"gmail-markdown gmail-prose gmail-w-full gmail-break-words gmai= l-dark:prose-invert gmail-light">

Hi.

I would like to register an R= FC on the following issue.
https://github.com/php/php-src/issues/13813

To summar= ize briefly, users expect that the `__callStatic` magic method will be call= ed in all cases when a method is not static while using the `__callStatic`.= However, in reality, if the method is public, the `__callStatic` magic met= hod is not called, and an error still occurs.

I would like to hear yo= ur opinions.
I also hope someone can help with the RFC regi= stration.


-------------------------------------------------------= -

```php
<?php
class MyClass
{
public static functio= n __callStatic($method, $args)
{
echo $method . "\n"; }

private function privateMethod() {}
protected function prot= ectedMethod() {}
public function publicMethod() {}
}

MyClass:= :privateMethod();
MyClass::protectedMethod();
MyClass::publicMethod()= ;
```

Resulted in this output:
```
privateMethod
protect= edMethod
Fatal error: Uncaught Error: Non-static method MyClass::publicM= ethod() cannot be called statically in ...
```

But I expected thi= s output instead:
```
privateMethod
protectedMethod
publicMetho= d
```


--000000000000ef0ed60614af4b95--