Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43991 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54764 invoked from network); 15 May 2009 16:49:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 May 2009 16:49:17 -0000 Authentication-Results: pb1.pair.com header.from=christopher.jones@oracle.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=christopher.jones@oracle.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain oracle.com from 148.87.113.123 cause and error) X-PHP-List-Original-Sender: christopher.jones@oracle.com X-Host-Fingerprint: 148.87.113.123 rcsinet11.oracle.com Received: from [148.87.113.123] ([148.87.113.123:56820] helo=rgminet11.oracle.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/DA-27038-C0D9D0A4 for ; Fri, 15 May 2009 12:49:17 -0400 Received: from rgminet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rgminet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n4FGnHOC019073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 May 2009 16:49:18 GMT Received: from abhmt001.oracle.com (abhmt001.oracle.com [141.146.116.10]) by rgminet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n4FGmqTE027946; Fri, 15 May 2009 16:48:52 GMT Received: from [192.168.1.5] (/204.14.154.198) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 15 May 2009 09:48:49 -0700 Message-ID: <4A0D9CEF.6060504@oracle.com> Date: Fri, 15 May 2009 09:48:47 -0700 User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: Simon Westcott CC: internals@lists.php.net References: <10.2A.54546.ECEC00A4@pb1.pair.com> In-Reply-To: <10.2A.54546.ECEC00A4@pb1.pair.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: abhmt001.oracle.com [141.146.116.10] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4A0D9CF2.0029:SCFSTAT5015188,ss=1,fgs=0 Subject: Re: [PHP-DEV] First test submission and comment correction From: christopher.jones@oracle.com (Christopher Jones) Simon Westcott wrote: > Hi, > > I've just started to explore PHP's tests, reading through the docs on > qa.php.net, the wiki and a few blogs. Having gotten to a position where > I can run the tests and produce coverage reports I have my first > (simple) submission. It covers an edge case for array_multisort when an > empty array is provided. Hi Simon, Welcome! I've merged these for you. I added an exit() block to the test. See the "Last bit" section in http://qa.php.net/write-test.php Let us know if you have any questions or if there's anyway we can help you. What parts of PHP are you looking at now? Chris > > Test: > > $ cat ext/standard/tests/array/array_multisort_variation11.phpt > --TEST-- > Test array_multisort() function : usage variation - testing with empty > array > --FILE-- > /* Prototype : bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, > SORT_REGULAR|SORT_NUMERIC|SORT_STRING]] [, array ar2 [, > SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]], ...]) > * Description: Sort multiple arrays at once similar to how ORDER BY > clause works in SQL > * Source code: ext/standard/array.c > * Alias to functions: > */ > > echo "*** Testing array_multisort() : Testing with empty array ***\n"; > > var_dump(array_multisort(array())); > > ?> > ===DONE=== > --EXPECTF-- > *** Testing array_multisort() : Testing with empty array *** > bool(true) > ===DONE=== > > > Whilst producing this simple test I spotted a mistake in a related > comment which appears to originate from bug 24897. A patch against > PHP-5.3 follows, > > Index: ext/standard/array.c > =================================================================== > RCS file: /repository/php-src/ext/standard/array.c,v > retrieving revision 1.308.2.21.2.37.2.53 > diff -u -r1.308.2.21.2.37.2.53 array.c > --- ext/standard/array.c 13 Feb 2009 22:34:15 -0000 > 1.308.2.21.2.37.2.53 > +++ ext/standard/array.c 5 May 2009 22:56:53 -0000 > @@ -3789,7 +3789,7 @@ > } > } > > - /* If all arrays are empty or have only one entry, we don't need > to do anything. */ > + /* If all arrays are empty we don't need to do anything. */ > if (array_size < 1) { > for (k = 0; k < MULTISORT_LAST; k++) { > efree(ARRAYG(multisort_flags)[k]); > > > I appreciate this a trivial stuff, but any constructive feedback is > welcome. > > Regards, > Simon Westcott > -- Email: christopher.jones@oracle.com Twitter: http://twitter.com/ghrd