Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38701 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40587 invoked from network); 2 Jul 2008 11:57:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2008 11:57:09 -0000 Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.44.29 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 74.125.44.29 yx-out-2324.google.com Received: from [74.125.44.29] ([74.125.44.29:59266] helo=yx-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/80-37564-41D6B684 for ; Wed, 02 Jul 2008 07:57:08 -0400 Received: by yx-out-2324.google.com with SMTP id 3so58854yxj.83 for ; Wed, 02 Jul 2008 04:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=m3Gj3QeysZsULIiayMT1JMDW5X252XEIgkhh66hhWW4=; b=WeTqunBC8ze44M7DfAxhAKAETdHbmwPmqflsUVY/ttLwDG7YCwRwqOKKPwNxRDWZV/ bOWQhFK/gM7scijbI/t8M5XE+fMv/QO42f9FD8X5CETFyfx6z7wT1iXzeFAQ1KnD1lhx F7PC0/DxyPwEq/MDtUL32jkSfOGjqJRTKkQ7U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=N7x0nL2JpRSqTy8ICMerQoZwsCVM5VV+q7nPMTDs5VzY//gEz5lVxOnrBQuneqJa2w h2SVllyn5Z66hS3z/SoKOxASltaHeEdzStZvsLsdU7ZkrKwJoV5q/Twsx1d2Xne+GANE T+UKzVzxB7DAHoChLqrHeLqN0Wn9H8qjnA5KQ= Received: by 10.150.227.14 with SMTP id z14mr12767052ybg.145.1214999826039; Wed, 02 Jul 2008 04:57:06 -0700 (PDT) Received: by 10.151.83.19 with HTTP; Wed, 2 Jul 2008 04:57:06 -0700 (PDT) Message-ID: Date: Wed, 2 Jul 2008 13:57:06 +0200 Sender: ekneuss@gmail.com To: "PHP internals" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: b7990fdd953aea89 Subject: [RFC] Modify resolution order of count_elements handler From: colder@php.net ("Etienne Kneuss") Hi, I'd like to fix the resolution order of Countable::count() vs count_elements handler. Currently, things are done like this: 1) check if the object implements countable, if so, call it's method 2) if not, check if count_elements handler is defined, if so, use it. This is a problematic order of resolution, and I'd like to inverse it. Why? Because : 1) it is inconsistent with other handlers 2) it makes it impossible to be userland friendly while saving a method call when it's possible. Currently, there are 3 possibilities: 1) the internal class doesn't use count_elements handler -> No problem with the change 2) the internal class uses only the handler -> It's not userland friendly, the change won't help, so it needs to be fixed anyway 3) both the handler and the method are used -> the handler was never called directly, such classes will need a fix after that resolution order change. Userland classes are not affected. I can and will take care of every problems occuring in classes in php-src (2 or 3, mostly SPL). Patches and details: http://wiki.php.net/rfc/array_count_handlers Regards -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal