Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31329 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67120 invoked by uid 1010); 30 Jul 2007 19:31:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 67100 invoked from network); 30 Jul 2007 19:31:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jul 2007 19:31:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=bruno.lists@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bruno.lists@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.162.225 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: bruno.lists@gmail.com X-Host-Fingerprint: 64.233.162.225 nz-out-0506.google.com Received: from [64.233.162.225] ([64.233.162.225:31643] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 30/17-26552-35C3EA64 for ; Mon, 30 Jul 2007 15:30:35 -0400 Received: by nz-out-0506.google.com with SMTP id x7so953121nzc for ; Mon, 30 Jul 2007 12:30:13 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=lmicyYLKv0K/jkj+JVgCcskaYbgB6rnglalBspYwXSweB6hjolmYS7aWIAH8mA+BaSZSiVY+cYsV3hYXbuPMLyveLFKVXgKn7QuUrtqW3kkD34aLQeBkE0L2jKaaIECXo8xO+m3Uy8dwf+IvtzF/0E93Kzz1Oit8tZ1Vf5JCAfU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gqezLnbjhuCLP0MRWyoI7a/qWjQ1do4R4ZGDloX1QjKviLY9xkOwvlZ3nDAbngXgWWll0CWFdKOBHnfsue2cX/pVb8D2I7a/4zw93xRWHtWyOCRliwsqBtnaG9n0/aqPBpNiKotbVmhMUYJ6U/GEa2nw70kDU82CpHLPhsEWF2U= Received: by 10.115.88.1 with SMTP id q1mr5914872wal.1185823812635; Mon, 30 Jul 2007 12:30:12 -0700 (PDT) Received: by 10.114.112.9 with HTTP; Mon, 30 Jul 2007 12:30:12 -0700 (PDT) Message-ID: Date: Mon, 30 Jul 2007 16:30:12 -0300 To: internals@lists.php.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <468519DC.8060502@widescreen.ch> <4685785E.5010709@zend.com> <585221804.20070701154538@marcus-boerger.de> <1259100072.20070730203433@marcus-boerger.de> Subject: [PHP-DEV] toString() and Object #ID From: bruno.lists@gmail.com ("Bruno Lustosa") On 7/30/07, Marcus Boerger wrote: > Hello Pavel, > > I still fail to understand why spl_object_hash() does not work for you. Hello. Just as a side note, this broke a few things for me. For example, in an application, I have 2 arrays of objects, and I try to call array_diff() on them. Before PHP 5.2, it would work, possibly because array_diff() would cast the objects as strings, and then compare them (if I understood the problem correctly). Now, this doesn't work anymore, because the object can't be cast to string by default. Of course, I could add a __toString() method to the objects and return something there, but problem is, all objects are extended from a base class from PEAR (it's DB_DataObject), and it wouldn't be a Good Thing to modify the PEAR class directly (updates would break). So, I got kind of stuck, and tried to add the __toString() dynamically to the objects in question using the "runkit" PECL package, but although it adds the method correctly, PHP doesn't recognize it as a magic method, and won't call it when needed (filed bug #11691 on PECL for it). Do you think there's an easy and clean approaching to solve this kind of problem? Or maybe the problem should be solved on array_diff() and other functions to make them not try to cast the object as a string to compare? Thanks -- Bruno Lustosa ZCE - Zend Certified Engineer - PHP! http://www.lustosa.net/