Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2311 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98665 invoked from network); 13 Jun 2003 10:06:32 -0000 Received: from unknown (HELO ied.ac.cn) (211.99.43.218) by pb1.pair.com with SMTP; 13 Jun 2003 10:06:32 -0000 Received: (qmail 15838 invoked by uid 610); 13 Jun 2003 17:22:43 +0800 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 13 Jun 2003 17:22:43 +0800 Date: Fri, 13 Jun 2003 17:22:43 +0800 (CST) X-X-Sender: hewei@web.ied.ac.cn To: internals@lists.php.net cc: Andrei Zmievski In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: The aggregation/Zend hash bug From: hewei@ied.org.cn (Wei He) References: Hi, I didn't receive and emails regarding to my discovery of the bug. If it wasn't because the mailing list or my email server's problem, it would turned out to be that nobody cares about it. Then what if, according to my own debugging, the problem is related to zend hash? I guess the answer to the following error is that unset($a) freed the object but not the all the hash tables (aggretated methods) associated with it. So a new object after the unset will reuse the same memory location and zend_hash_add will return a failure. zend_hash.c: in function zend_hash_add_or_update while (p != NULL) { if ((p->h == h) && (p->nKeyLength == nKeyLength)) { if (!memcmp(p->arKey, arKey, nKeyLength)) { if (flag & HASH_ADD) { return FAILURE; } HANDLE_BLOCK_INTERRUPTIONS(); Can anyone understading zend hash functions well check why this would happen? Shouldn't unset($a) clean everything related to it? Please! I can't live without aggregation and I can't work any longer due to the bug. If you really don't think it a bug. Would anyone kindly reply me a message so that at least I know you guys have received my report? Wei He On Fri, 23 May 2003, Wei He wrote: > Hi, > > This short script can reproduce the aggregation bug I reported above. > > class bar { > > function doit() > { > print " Doing...\n"; > } > } > > class foo { > > function foo() > { > print_r(aggregation_info($this)); > aggregate($this, "bar"); > } > > function spawn() > { > return new foo(); > } > } > > $a = new foo(); > $a->doit(); > $b = $a->spawn(); > $b->doit(); > unset($a); > $c = $b->spawn(); > $c->doit(); > > Besides 'unset($a)', '$a = new foo()' will also cause the same problem. > > Wei He > >