Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34501 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84253 invoked by uid 1010); 5 Jan 2008 10:50:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 84237 invoked from network); 5 Jan 2008 10:50:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2008 10:50:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:42260] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/E3-52950-9D06F774 for ; Sat, 05 Jan 2008 05:50:02 -0500 Received: from MBOERGER-ZRH.corp.google.com (52-208.0-85.cust.bluewin.ch [85.0.208.52]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 7D78E1B365C; Sat, 5 Jan 2008 11:49:59 +0100 (CET) Date: Sat, 5 Jan 2008 11:49:32 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1306229753.20080105114932@marcus-boerger.de> To: Gregory Beaver CC: internals Mailing List In-Reply-To: <477EF88C.1000309@chiaraquartet.net> References: <477ED7CC.4090307@chiaraquartet.net> <477EF08F.5050609@chiaraquartet.net> <477EF88C.1000309@chiaraquartet.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: how to test using run-tests? From: helly@php.net (Marcus Boerger) Hello Gregory, Saturday, January 5, 2008, 4:25:00 AM, you wrote: > Index: run-tests.php > =================================================================== > RCS file: /repository/php-src/run-tests.php,v > retrieving revision 1.226.2.37.2.35.2.10 > diff -u -r1.226.2.37.2.35.2.10 run-tests.php > --- run-tests.php 1 Jan 2008 06:15:40 -0000 1.226.2.37.2.35.2.10 > +++ run-tests.php 5 Jan 2008 03:22:01 -0000 > @@ -1034,7 +1034,7 @@ > if (preg_match('/^--([_A-Z]+)--/', $line, $r)) { > $section = $r[1]; > $section_text[$section] = ''; > - $secfile = $section == 'FILE' || $section == 'FILEEOF'; > + $secfile = $section == 'FILE' || $section == 'FILEEOF' || $section > == 'FILE_EXTERNAL'; > $secdone = false; > continue; > } > @@ -1060,7 +1060,7 @@ > $borked = false; > } > } else { > - if (@count($section_text['FILE']) + > @count($section_text['FILEEOF']) != 1) { > + if (@count($section_text['FILE']) + @count($section_text['FILEEOF']) + > @count($section_text['FILE_EXTERNAL']) != 1) { > $bork_info = "missing section --FILE--"; > $borked = true; > } > @@ -1068,6 +1068,17 @@ > $section_text['FILE'] = preg_replace("/[\r\n]+$/", '', > $section_text['FILEEOF']); > unset($section_text['FILEEOF']); > } > + if (@count($section_text['FILE_EXTERNAL']) == 1) { > + // don't allow tests to retrieve files from anywhere but this > subdirectory > + $section_text['FILE_EXTERNAL'] = dirname($file) . '/' . > trim(str_replace('..', '', $section_text['FILE_EXTERNAL'])); > + if (@file_exists($section_text['FILE_EXTERNAL'])) { > + $section_text['FILE'] = > file_get_contents($section_text['FILE_EXTERNAL']); > + unset($section_text['FILE_EXTERNAL']); > + } else { > + $bork_info = "could not load --FILE_EXTERNAL-- " . > dirname($file) . '/' . trim($section_text['FILE_EXTERNAL']); > + $borked = true; > + } > + } > if ((@count($section_text['EXPECT']) + @count($section_text['EXPECTF']) + > @count($section_text['EXPECTREGEX'])) != 1) { > $bork_info = "missing section --EXPECT--, --EXPECTF-- or > --EXPECTREGEX--"; > $borked = true; > @@ -1093,7 +1104,7 @@ > $tested = trim($section_text['TEST']); > > /* For GET/POST tests, check if cgi sapi is available and if it is, use it. */ > - if (!empty($section_text['GET']) || !empty($section_text['POST']) || > !empty($section_text['POST_RAW']) || !empty($section_text['COOKIE'])) { > + if (!empty($section_text['GET']) || !empty($section_text['POST']) || > !empty($section_text['POST_RAW']) || !empty($section_text['COOKIE']) || > !empty($section_text['EXPECT_HEADERS'])) { > if (isset($php_cgi)) { > $old_php = $php; > $php = $php_cgi .' -C '; > @@ -1355,12 +1366,15 @@ > $raw_lines = explode("\n", $post); > > $request = ''; > + $started = false; > foreach ($raw_lines as $line) { > if (empty($env['CONTENT_TYPE']) && > preg_match('/^Content-Type:(.*)/i', $line, $res)) { > $env['CONTENT_TYPE'] = > trim(str_replace("\r", '', $res[1])); > continue; > } > - $request .= $line . "\n"; > + if ($started) $request .= "\n"; > + $started = true; > + $request .= $line; > } > > $env['CONTENT_LENGTH'] = strlen($request); Please apply this to PHP 5.2, 5.3 and HEAD. Best regards, Marcus