Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21203 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93618 invoked by uid 1010); 13 Dec 2005 18:23:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 93603 invoked from network); 13 Dec 2005 18:23:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2005 18:23:35 -0000 X-Host-Fingerprint: 64.233.184.192 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.192:26977] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 0B/0F-49905-4811F934 for ; Tue, 13 Dec 2005 13:23:00 -0500 Received: by wproxy.gmail.com with SMTP id i24so1706431wra for ; Tue, 13 Dec 2005 10:22:22 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S0IJxtYu6qDTuOZR/BiwzfdkzCv9U9UXWUm08cdYTFkfVElPXC6eCJw44w18EJ4tPgXSno8YKfWo5KFmPwhcebMPe1h+CRMU+/ZR/SHhvD7w/O6dMyOhfJouirWJmpcT6dTpvcUrGwvVfenNk+zkMW9ovDfp/T5+jiQb9yxdUtk= Received: by 10.54.68.6 with SMTP id q6mr1413688wra; Tue, 13 Dec 2005 10:22:22 -0800 (PST) Received: by 10.54.77.20 with HTTP; Tue, 13 Dec 2005 10:22:22 -0800 (PST) Message-ID: <4e89b4260512131022v447d33b8yfeb03ac65c53d1b2@mail.gmail.com> Date: Tue, 13 Dec 2005 13:22:22 -0500 To: "D. Walsh" Cc: PHP-DEV In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: Subject: Re: [PHP-DEV] bug ??? From: kingwez@gmail.com (Wez Furlong) Even looking at the page you linked to, I have no idea what the problem actually is. You need to be a bit more specific if you want people to help you. One thing I notice is that you're using the old parameter fetching API, and not using it properly. If a non-string is passed to your functions, you'll most likely crash. On 12/12/05, D. Walsh wrote: > I have the following code, it works properly under 4.3.9, 4.3.10. > 4.3.11, 4.4.0, 5.0.2, 5.0.3, 5.0.4 > > Under 5.1.2-dev, it doesn't perform as expected. > > I've scripted the configure options so all builds are the same so the > only thing changing is the version of PHP. > > Here's a link which shows what the results should be and what they are. > http://www.daleenterprise.com/test.php > > I'm not sure if a bug report is really required as it may be some > minor change I am unaware of and the included dev docs don't state so > how to proceed? > > > Here's the code for the two routines in question.. > > > /* {{{ proto string clam_scan_buffer(string $buffer) > Scan a given buffer for viruses. Returns false if no virus > present */ > PHP_FUNCTION(clam_scan_buffer) { > zval **buffer; > char *real_buffer =3D NULL; > long retb; > const char *virname; > > /* make sure virus dbdir exists - prevents a segfault */ > if (cl_error) { > php_error( E_WARNING, "Virus database directory (%s) does= not > exist", INI_STR("clam.virus_dbdir")) ; > RETURN_FALSE; > } > > /* parse zend input */ > if (ZEND_NUM_ARGS() !=3D 1 || (zend_get_parameters_ex(1, &buffer)= =3D=3D > FAILURE)) { > WRONG_PARAM_COUNT; > } > > /* convert zval input to real strings */ > real_buffer =3D Z_STRVAL_PP(buffer); > > /* scan buffer */ > retb =3D cl_scanbuff(real_buffer ,strlen(real_buffer), &virname, = root); > if (retb =3D=3D CL_VIRUS) { > RETURN_STRINGL((char *)virname,strlen(virname),1); > } else if (retb =3D=3D CL_CLEAN) { > RETURN_FALSE; > } else { > php_error(E_WARNING,"error: %s", cl_strerror(retb)); > RETURN_FALSE; > } > } > /* }}} */ > > > /* {{{ proto string clam_scan_file(string $file) > Scan a given file for viruses. Returns false if no virus present */ > PHP_FUNCTION(clam_scan_file) { > zval **file; > char *real_file =3D NULL; > long options =3D CL_SCAN_STDOPT; > long retf; > const char *virname; > > /* make sure virus dbdir exists - prevents a segfault */ > if (cl_error) { > php_error( E_WARNING, "Virus database directory (%s) does= not > exist", INI_STR("clam.virus_dbdir")) ; > RETURN_FALSE; > } > > /* parse zend input */ > if (ZEND_NUM_ARGS() !=3D 1 || zend_get_parameters_ex(1, &file) = =3D=3D > FAILURE) { > WRONG_PARAM_COUNT; > } > > /* convert zval input to real strings */ > real_file =3D Z_STRVAL_PP(file); > > /* scan file */ > /*RETURN_STRINGL(real_file,strlen(real_file),1);*/ > retf =3D cl_scanfile(real_file, &virname, NULL, root, &limits, op= tions); > /* return result */ > if (retf =3D=3D CL_VIRUS) { > RETURN_STRINGL((char *)virname,strlen(virname),1); > } else if (retf =3D=3D CL_CLEAN) { > RETURN_FALSE; > } else { > php_error(E_WARNING,"error: %s", cl_strerror(retf)); > RETURN_FALSE; > } > } > /* }}} */ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >