Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7369 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15779 invoked by uid 1010); 28 Jan 2004 08:27:15 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 15747 invoked from network); 28 Jan 2004 08:27:15 -0000 Received: from unknown (HELO jdi.jdimedia.nl) (212.204.192.51) by pb1.pair.com with SMTP; 28 Jan 2004 08:27:15 -0000 Received: from localhost (localhost [127.0.0.1]) by jdi.jdimedia.nl (8.12.10/8.12.10) with ESMTP id i0S8RDvs030909; Wed, 28 Jan 2004 09:27:14 +0100 Date: Wed, 28 Jan 2004 09:26:41 +0100 (CET) X-X-Sender: derick@localhost Reply-To: PHP Developers Mailing List To: unkno me cc: PHP Developers Mailing List In-Reply-To: <20040127225329.77188.qmail@web21504.mail.yahoo.com> Message-ID: References: <20040127225329.77188.qmail@web21504.mail.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] zend_parse_parameters question From: derick@php.net (Derick Rethans) On Tue, 27 Jan 2004, unkno me wrote: > I am using the zend_parse_parameter function to > retrieve a string passed to my function like: > > char* s, int sl; You need to use a long for sl here. > > zend_parse_parameter(ZEND_NUM_ARGS() TSRMLS_CC,"s", &s,&sl); Shouldn't it be zend_parse_parameters (with an extra s?) > > and then later I am using the memcmp function to test > 2 strings like: > > memcmp(key,s,sl); > > but for some reason, the memcmp never return 0 > indicates key and s is the same even I KNOW key and s > is indeed the same. key and s is always of the same > length. In fact, even doing a: > > fprintf(stderr,"[%s %i]\n",s,sl); > > yields different result for s and sl than what's > really passed to my function. Why is that? Is there a > bug in the zend_parse_paramter function that I am not > aware of? I should mention that: > > 1. The string is always ASCII > 2. Sometimes, I do see the expected result but not all > the time. That's what makes me so confuse. Might be memory curruption somewhere else, try to run with valgrind to see if that's the case. regards, Derick