Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38694 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11879 invoked from network); 1 Jul 2008 22:55:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2008 22:55:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=ralph@smashlabs.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ralph@smashlabs.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain smashlabs.com from 67.15.58.61 cause and error) X-PHP-List-Original-Sender: ralph@smashlabs.com X-Host-Fingerprint: 67.15.58.61 openrce.org Linux 2.6 Received: from [67.15.58.61] ([67.15.58.61:45894] helo=users.smashlabs.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/00-10269-9F5BA684 for ; Tue, 01 Jul 2008 18:55:54 -0400 Received: (qmail 27767 invoked from network); 1 Jul 2008 17:55:50 -0500 Received: from cpe-24-174-112-72.austin.res.rr.com (HELO ralph-macbook.local) (24.174.112.72) by smashlabs.com with (DHE-RSA-AES256-SHA encrypted) SMTP; 1 Jul 2008 17:55:50 -0500 Message-ID: <486AB5F5.50400@smashlabs.com> Date: Tue, 01 Jul 2008 17:55:49 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: internals Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Magic method visibility in PHP 5.3+ From: ralph@smashlabs.com (Ralph Schindler) Well, I guess I blinked and missed the internal@ thread on this topic :) Seriously though, if there was a thread on this subject, please point me in the right direction. In PHP 5.3 snaps, it appears that magic methods __isset, __unset, __get, __set must have a public visibility or the engine will trigger a warning. Why is this? It works as expected in 5.x branches. I am not sure why this should be enforced as it should be up to the developer as to which methods in the API should be exposed for direct invocation. If a developer never intends on a user calling $obj->__set(...), then it should be allowed that the public call to that method be disallowed, but still allow the magic functionality (b/c of the presence of that magic function.) Without getting too long winded, ill just put code and warnings below. Cheers, Ralph Schindler script.php