1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-17 14:18:24 +01:00

Merge branch '3.3.x'

This commit is contained in:
Marc Alexander 2020-10-25 16:21:07 +01:00
commit 72080f970f
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
13 changed files with 91 additions and 7 deletions

View File

@ -21,6 +21,8 @@ matrix:
env: DB=mysqli
- php: 7.4
env: DB=mysqli
- php: 7.4
env: DB=mysqli;MYSQL8=1
- php: nightly
env: DB=mysqli
allow_failures:
@ -39,7 +41,7 @@ services:
- memcached
install:
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION $NOTESTS
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0}
before_script:
- travis/setup-database.sh $DB $TRAVIS_PHP_VERSION $NOTESTS

View File

@ -118,7 +118,7 @@ function generate_smilies($mode, $forum_id)
SMILIES_TABLE => 's',
],
'GROUP_BY' => 's.smiley_url, s.smiley_width, s.smiley_height',
'ORDER_BY' => 'min_smiley_order',
'ORDER_BY' => $db->sql_quote('min_smiley_order'),
];
}
else

View File

@ -1300,7 +1300,7 @@ class convertor
else
{
// No table alias
$sql_data['source_tables'][$m[1]] = (empty($convert->src_table_prefix)) ? $m[1] : $convert->src_table_prefix . $m[1] . ' ' . $m[1];
$sql_data['source_tables'][$m[1]] = (empty($convert->src_table_prefix)) ? $m[1] : $convert->src_table_prefix . $m[1] . ' ' . $db->sql_quote($m[1]);
}
$sql_data['select_fields'][$value_1] = $value_1;
@ -1314,7 +1314,7 @@ class convertor
{
foreach ($m[1] as $value)
{
$sql_data['source_tables'][$value] = (empty($convert->src_table_prefix)) ? $value : $convert->src_table_prefix . $value . ' ' . $value;
$sql_data['source_tables'][$value] = (empty($convert->src_table_prefix)) ? $value : $convert->src_table_prefix . $value . ' ' . $db->sql_quote($value);
}
}
}
@ -1323,7 +1323,7 @@ class convertor
// Add the aliases to the list of tables
foreach ($aliases as $alias => $table)
{
$sql_data['source_tables'][$alias] = $convert->src_table_prefix . $table . ' ' . $alias;
$sql_data['source_tables'][$alias] = $convert->src_table_prefix . $table . ' ' . $db->sql_quote($alias);
}
// 'left_join' => 'forums LEFT JOIN forum_prune ON forums.forum_id = forum_prune.forum_id',

View File

@ -464,4 +464,12 @@ interface driver_interface
* @return string A SQL statement like: "IN (1, 2, 3, 4)" or "= 1"
*/
public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false);
/**
* Quote identifiers used in sql query
*
* @param string $msg String to be quoted
* @return string Quoted version of $msg
*/
public function sql_quote($msg);
}

View File

@ -456,4 +456,12 @@ class factory implements driver_interface
{
return $this->get_driver()->sql_in_set($field, $array, $negate, $allow_empty_set);
}
/**
* {@inheritdoc}
*/
public function sql_quote($msg)
{
return $this->get_driver()->sql_quote($msg);
}
}

View File

@ -76,4 +76,12 @@ abstract class mssql_base extends \phpbb\db\driver\driver
{
return $data;
}
/**
* {@inheritDoc}
*/
function sql_quote($msg)
{
return '"' . $msg . '"';
}
}

View File

@ -489,4 +489,12 @@ class mysqli extends \phpbb\db\driver\mysql_base
break;
}
}
/**
* {@inheritDoc}
*/
function sql_quote($msg)
{
return '`' . $msg . '`';
}
}

View File

@ -818,4 +818,12 @@ class oracle extends \phpbb\db\driver\driver
break;
}
}
/**
* {@inheritDoc}
*/
function sql_quote($msg)
{
return '"' . $msg . '"';
}
}

View File

@ -497,4 +497,12 @@ class postgres extends \phpbb\db\driver\driver
break;
}
}
/**
* {@inheritDoc}
*/
function sql_quote($msg)
{
return '"' . $msg . '"';
}
}

View File

@ -427,4 +427,12 @@ class sqlite3 extends \phpbb\db\driver\driver
break;
}
}
/**
* {@inheritDoc}
*/
function sql_quote($msg)
{
return '\'' . $msg . '\'';
}
}

View File

@ -28,7 +28,7 @@ class phpbb_functional_smilies_test extends phpbb_functional_test_case
SMILIES_TABLE => 's',
],
'GROUP_BY' => 's.smiley_url, s.smiley_width, s.smiley_height',
'ORDER_BY' => 'min_smiley_order',
'ORDER_BY' => $db->sql_quote('min_smiley_order'),
];
$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);
@ -39,7 +39,7 @@ class phpbb_functional_smilies_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'posting.php?mode=smilies');
foreach ($smilies as $index => $smiley)
{
$this->assertContains($smiley['smiley_url'],
$this->assertStringContainsString($smiley['smiley_url'],
$crawler->filter('div[class="inner"] > a > img')->eq($index)->attr('src')
);
}

20
travis/setup-mysql8.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @license GNU General Public License, version 2 (GPL-2.0)
#
# For full copyright and license information, please see
# the docs/CREDITS.txt file.
#
set -e
set -x
wget https://repo.mysql.com//mysql-apt-config_0.8.15-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
sudo apt-get update -q
sudo apt-get install -q -y --allow-unauthenticated -o Dpkg::Options::=--force-confnew mysql-server
sudo systemctl restart mysql
sudo mysql_upgrade
mysql --version

View File

@ -14,6 +14,7 @@ set -x
DB=$1
TRAVIS_PHP_VERSION=$2
NOTESTS=$3
MYSQL8=$4
if [ "$NOTESTS" == '1' ]
then
@ -26,6 +27,11 @@ then
travis/setup-mariadb.sh
fi
if [ "$MYSQL8" == '1' ]
then
travis/setup-mysql8.sh
fi
if [ "$NOTESTS" != '1' ]
then
travis/setup-php-extensions.sh