Doc #71158 [Opn->Dup]: Calling methods with reserved keywords is inconsistent.

From: Date: Fri, 18 Dec 2015 12:57:28 +0000
Subject: Doc #71158 [Opn->Dup]: Calling methods with reserved keywords is inconsistent.
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12958@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71158&edit=1 ID: 71158 Updated by: requinix@php.net Reported by: gregorv at web dot de Summary: Calling methods with reserved keywords is inconsistent. -Status: Open +Status: Duplicate Type: Documentation Problem Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2015-12-18 12:56:33] gregorv at web dot de Bug report originally inspired by http://stackoverflow.com/questions/34353400/php-using-language-constructs-in-combination-with-magic-methods/34355096?noredirect=1#comment56453476_34355096 User: hek2mgl ------------------------------------------------------------------------ [2015-12-18 12:37:12] gregorv at web dot de Description: ------------ Inconsistent parsing errors for using language constructs as functions in combination with magic methods. Calling methods with names of reserved keywords produce a fatal error when called statically like Something::list(), but work perfectly well when doing $something->list(); See code in Test Script. Test script: --------------- class Testing { public function scopeList() { echo "scopeList"; } public function __call($method, $parameters) { if($method == "list") { $this->scopeList(); } } public static function __callStatic($method, $parameters) { $instance = new static; call_user_func_array([$instance, $method], $parameters); } } // Testingg::list() failes; //Testing::list(); $testing = new Testing(); $testing->list(); // this does not ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71158&edit=1

« previous php.doc.bugs (#12958) next »