Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21201 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1804 invoked by uid 1010); 12 Dec 2005 21:34:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1786 invoked from network); 12 Dec 2005 21:34:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2005 21:34:49 -0000 X-Host-Fingerprint: 67.78.11.229 daleenterprise.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (1) Received: from ([67.78.11.229:64398] helo=daleenterprise.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 52/E4-49905-8FCED934 for ; Mon, 12 Dec 2005 16:34:48 -0500 Received: from localhost (localhost [127.0.0.1]) by daleenterprise.com (Postfix) with ESMTP id 986633832CD for ; Mon, 12 Dec 2005 16:34:10 -0500 (EST) Received: from daleenterprise.com ([127.0.0.1]) by localhost (daleenterprise.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14473-05 for ; Mon, 12 Dec 2005 16:34:10 -0500 (EST) Received: from [10.1.100.11] (relay.mustangrestomods.com [67.78.11.226]) by daleenterprise.com (Postfix) with ESMTP id D1E0D3832C3 for ; Mon, 12 Dec 2005 16:34:09 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) Content-Transfer-Encoding: 7bit Message-ID: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: PHP-DEV Date: Mon, 12 Dec 2005 16:34:08 -0500 X-Mailer: Apple Mail (2.746.2) MTA-Interface: amavisd-new-2.3.3 (20050822) at daleenterprise.com X-Spam-Scanned: using SpamAssassin 3.1.0 (2005-09-13) at daleenterprise.com X-Virus-Scanned: using Clamav 0.87.1 (2005-11-03) at daleenterprise.com Subject: bug ??? From: info@daleenterprise.com ("D. Walsh") 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 = 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() != 1 || (zend_get_parameters_ex(1, &buffer) == FAILURE)) { WRONG_PARAM_COUNT; } /* convert zval input to real strings */ real_buffer = Z_STRVAL_PP(buffer); /* scan buffer */ retb = cl_scanbuff(real_buffer ,strlen(real_buffer), &virname, root); if (retb == CL_VIRUS) { RETURN_STRINGL((char *)virname,strlen(virname),1); } else if (retb == 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 = NULL; long options = 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() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) { WRONG_PARAM_COUNT; } /* convert zval input to real strings */ real_file = Z_STRVAL_PP(file); /* scan file */ /*RETURN_STRINGL(real_file,strlen(real_file),1);*/ retf = cl_scanfile(real_file, &virname, NULL, root, &limits, options); /* return result */ if (retf == CL_VIRUS) { RETURN_STRINGL((char *)virname,strlen(virname),1); } else if (retf == CL_CLEAN) { RETURN_FALSE; } else { php_error(E_WARNING,"error: %s", cl_strerror(retf)); RETURN_FALSE; } } /* }}} */