Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21172 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21130 invoked by uid 1010); 11 Dec 2005 12:29:47 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21115 invoked from network); 11 Dec 2005 12:29:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2005 12:29:47 -0000 X-Host-Fingerprint: 80.91.229.2 main.gmane.org Linux 2.5 (sometimes 2.4) (4) Received: from ([80.91.229.2:57701] helo=ciao.gmane.org) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id DF/47-49905-89B1C934 for ; Sun, 11 Dec 2005 07:29:12 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1ElQIO-0002jL-Le for internals@lists.php.net; Sun, 11 Dec 2005 13:27:16 +0100 Received: from p50884faf.dip.t-dialin.net ([80.136.79.175]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Dec 2005 13:27:16 +0100 Received: from sb by p50884faf.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Dec 2005 13:27:16 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Sun, 11 Dec 2005 13:25:26 +0100 Lines: 67 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: p50884faf.dip.t-dialin.net User-Agent: Thunderbird 1.5 (Windows/20051025) Sender: news Subject: bad type specifier while parsing parameters From: sb@sebastian-bergmann.de (Sebastian Bergmann) The code below (which is based on Derick's code [1]) used to work until recently: hasProperty($propertyName)) { $property = $class->getProperty($propertyName); if (!$property->isPublic()) { if ($property->isProtected()) { $propertyName = "\0*\0" . $propertyName; } else { $propertyName = sprintf( "\0%s\0%s", get_class($object), $propertyName ); } $tmp = (array) $object; return $tmp[$propertyName]; } else { return $object->$propertyName; } } else { throw new InvalidArgumentException; } } catch (ReflectionException $e) { throw new InvalidArgumentException; } } $object = new ClassWithNonPublicProperties; print getNonPublicProperty($object, 'protectedProperty') . "\n"; print getNonPublicProperty($object, 'privateProperty') . "\n"; ?> The current PHP_5_1 prints Warning: ReflectionClass::getProperty(): bad type specifier while parsing parameters in test.php on line 12 Fatal error: Call to a member function isPublic() on a non-object in test.php on line 14 Is this change in behaviour intentional or should I file a bug report for this? -- [1] http://derickrethans.nl/private_properties_exposed.php -- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69