Visitar URL original
#[\Deprecated] does not work for __call() and __callStatic() · Issue #17597 · php/php-src · GitHub
Skip to content

#[\Deprecated] does not work for __call() and __callStatic() #17597

Closed

Description

@TimWolla

Description

The following code:

<?php

class Clazz {
	#[\Deprecated]
	function __call(string $name, array $params) {
	}

	#[\Deprecated("due to some reason")]
	static function __callStatic(string $name, array $params) {
	}
}

$cls = new Clazz();
$cls->test();
Clazz::test2();

?>

Resulted in this output:

But I expected this output instead:

Deprecated: Method Clazz::test() is deprecated in %s

Deprecated: Method Clazz::test2() is deprecated, due to some reason in %s on line %d

PHP Version

PHP 8.4.3

Operating System

No response

Activity

  1. self-assigned this
    on Jan 27, 2025
  2. added a commit that references this issue on Jan 27, 2025
    22dc09c
  3. TimWolla commented on Jan 27, 2025

    @TimWolla
    MemberAuthor

    For posterity: The attribute already works for all other magic methods. See: #17592 (comment)

  4. added a commit that references this issue on Jan 27, 2025
    f37b165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions