cvs: pear-core /PEAR/PackageFile/v2 Validator.php

From: Date: Fri, 28 Mar 2008 20:47:16 +0000
Subject: cvs: pear-core /PEAR/PackageFile/v2 Validator.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7411@lists.php.net to get a copy of this message
dufuz Fri Mar 28 20:47:16 2008 UTC Modified files: /pear-core/PEAR/PackageFile/v2 Validator.php Log: Bug #13485 pear package-validate brings up ASCII issues http://cvs.php.net/viewvc.cgi/pear-core/PEAR/PackageFile/v2/Validator.php?r1=1.104&r2=1.105&diff_format=u Index: pear-core/PEAR/PackageFile/v2/Validator.php diff -u pear-core/PEAR/PackageFile/v2/Validator.php:1.104 pear-core/PEAR/PackageFile/v2/Validator.php:1.105 --- pear-core/PEAR/PackageFile/v2/Validator.php:1.104 Sat Mar 22 02:31:27 2008 +++ pear-core/PEAR/PackageFile/v2/Validator.php Fri Mar 28 20:47:16 2008 @@ -15,7 +15,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 1997-2008 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Validator.php,v 1.104 2008/03/22 02:31:27 dufuz Exp $ + * @version CVS: $Id: Validator.php,v 1.105 2008/03/28 20:47:16 dufuz Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a8 */ @@ -1867,7 +1867,17 @@ fclose($fp); $contents = file_get_contents($file); } - $tokens = token_get_all($contents); + + // Silence this function so we can catch PHP Warnings and show our own custom message + $tokens = @token_get_all($contents); + if (isset($php_errormsg)) { + $pn = $this->_pf->getPackage(); + $this->_stack->push(__FUNCTION__, 'warning', + array('file' => $file, 'package' => $pn), + 'in %file%: Could not process file for unkown reasons,' . + ' possibly a PHP parse error in %file% from %package%'); + + } /* for ($i = 0; $i < sizeof($tokens); $i++) { @list($token, $data) = $tokens[$i];

« previous php.pear.core (#7411) next »