cvs: pecl /apc apc.php

From: Date: Fri, 21 Mar 2008 21:17:44 +0000
Subject: cvs: pecl /apc apc.php
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-9998@lists.php.net to get a copy of this message
shire Fri Mar 21 21:17:44 2008 UTC Modified files: /pecl/apc apc.php Log: fix some preg issues when it includes '/', add an error if regex is invalid (patch by Evan Priestley) http://cvs.php.net/viewvc.cgi/pecl/apc/apc.php?r1=3.69&r2=3.70&diff_format=u Index: pecl/apc/apc.php diff -u pecl/apc/apc.php:3.69 pecl/apc/apc.php:3.70 --- pecl/apc/apc.php:3.69 Thu Jan 31 20:24:13 2008 +++ pecl/apc/apc.php Fri Mar 21 21:17:43 2008 @@ -22,7 +22,7 @@ */ -$VERSION='$Id: apc.php,v 3.69 2008/01/31 20:24:13 shire Exp $'; +$VERSION='$Id: apc.php,v 3.70 2008/03/21 21:17:43 shire Exp $'; ////////// READ OPTIONAL CONFIGURATION FILE //////////// if (file_exists("apc.conf.php")) include("apc.conf.php"); @@ -929,7 +929,7 @@ // ----------------------------------------------- case OB_USER_CACHE: if (!$AUTHENTICATED) { - echo '<div class="authneeded">You need to login to see the user values here!<br/>&nbsp;<br/>'; + echo '<div class="error">You need to login to see the user values here!<br/>&nbsp;<br/>'; put_login_link("Login now!"); echo '</div>'; break; @@ -1034,8 +1034,19 @@ '</select>', '&nbsp; Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>', '&nbsp;<input type=submit value="GO!">', - '</form></div>', + '</form></div>'; + + if (isset($MYREQUEST['SEARCH'])) { + // Don't use preg_quote because we want the user to be able to specify a + // regular expression subpattern. + $MYREQUEST['SEARCH'] = '/'.str_replace('/', '\\/', $MYREQUEST['SEARCH']).'/i'; + if (preg_match($MYREQUEST['SEARCH'], 'test') === false) { + echo '<div class="error">Error: enter a valid regular expression as a search query.</div>'; + break; + } + } + echo '<div class="info"><table cellspacing=0><tbody>', '<tr>', '<th>',sortheader('S',$fieldheading, "&OB=".$MYREQUEST['OB']),'</th>', @@ -1085,7 +1096,7 @@ // output list $i=0; foreach($list as $k => $entry) { - if(!$MYREQUEST['SEARCH'] || preg_match('/'.$MYREQUEST['SEARCH'].'/i', $entry[$fieldname]) != 0) { + if(!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry[$fieldname]) != 0) { echo '<tr class=tr-',$i%2,'>', "<td class=td-0><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",md5($entry[$fieldkey]),"\">",$entry[$fieldname],'</a></td>',

« previous php.pecl.cvs (#9998) next »