* @return string Regex pattern, for preg_match()
*/
private static function makeRegex( $filterEntry, $protocol ) {
- $regex = '!' . preg_quote( $protocol );
+ $regex = '!' . preg_quote( $protocol, '!' );
if ( substr( $filterEntry, 0, 2 ) == '*.' ) {
$regex .= '(?:[A-Za-z0-9.-]+\.|)';
$filterEntry = substr( $filterEntry, 2 );
}
$sql = $obj->sql;
$sql = preg_replace(
- '/(?<=\W)"?' . preg_quote( trim( $this->addIdentifierQuotes( $oldName ), '"' ) ) . '"?(?=\W)/',
+ '/(?<=\W)"?' .
+ preg_quote( trim( $this->addIdentifierQuotes( $oldName ), '"' ), '/' ) .
+ '"?(?=\W)/',
$this->addIdentifierQuotes( $newName ),
$sql,
1
$originalTables = $db->listTables( $db->_originalTablePrefix, __METHOD__ );
if ( $prefix === 'unprefixed' ) {
- $originalPrefixRegex = '/^' . preg_quote( $db->_originalTablePrefix ) . '/';
+ $originalPrefixRegex = '/^' . preg_quote( $db->_originalTablePrefix, '/' ) . '/';
$originalTables = array_map(
function ( $pt ) use ( $originalPrefixRegex ) {
return preg_replace( $originalPrefixRegex, '', $pt );
}
$keys = implode( '|',
- array_map( 'preg_quote', array_keys( $config[ApiBase::PARAM_TEMPLATE_VARS] ) )
+ array_map(
+ function ( $key ) {
+ return preg_quote( $key, '/' );
+ },
+ array_keys( $config[ApiBase::PARAM_TEMPLATE_VARS] )
+ )
);
$this->assertRegExp( '/^(?>[^{}]+|\{(?:' . $keys . ')\})+$/', $param,
"$param: Name may not contain '{' or '}' other than as defined by PARAM_TEMPLATE_VARS" );