Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/apt-x32/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ runs:
OPCACHE_TLS_TESTS_DEPS="gcc clang lld"

export DEBIAN_FRONTEND=noninteractive
dpkg --add-architecture i386
apt-get update -y | true
sudo dpkg --add-architecture i386
sudo env DEBIAN_FRONTEND=noninteractive apt-get update -y | true
# TODO: Reenable postgresql + postgresql-contrib packages once they work again.
apt-get install -y \
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \
autoconf \
bison \
curl \
Expand Down
16 changes: 8 additions & 8 deletions .github/actions/install-linux-x32/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ runs:
- shell: bash
run: |
set -x
make install
mkdir -p /etc/php.d
chmod 777 /etc/php.d
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
echo opcache.preload_user=root >> /etc/php.d/opcache.ini
sudo make install
sudo mkdir -p /etc/php.d
sudo chmod 777 /etc/php.d
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock | sudo tee /etc/php.d/mysqli.ini > /dev/null
echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock | sudo tee /etc/php.d/pdo_mysql.ini > /dev/null
echo opcache.enable_cli=1 | sudo tee /etc/php.d/opcache.ini > /dev/null
echo opcache.protect_memory=1 | sudo tee -a /etc/php.d/opcache.ini > /dev/null
echo opcache.preload_user=root | sudo tee -a /etc/php.d/opcache.ini > /dev/null
13 changes: 6 additions & 7 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,14 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(inputs.branch).jobs.LINUX_X32.matrix }}
name: "LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
runs-on: ubuntu-latest
# The container seccomp profile blocks i386 socket syscalls used by the test suite.
runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }}
timeout-minutes: 180
container:
image: ubuntu:${{ fromJson(inputs.branch).config.ubuntu_version }}
env:
MYSQL_TEST_HOST: mysql
PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test
PDO_MYSQL_TEST_HOST: mysql
PDO_FIREBIRD_TEST_DSN: firebird:dbname=firebird:test.fdb
MYSQL_TEST_HOST: 127.0.0.1
PDO_MYSQL_TEST_DSN: mysql:host=127.0.0.1;dbname=test
PDO_MYSQL_TEST_HOST: 127.0.0.1
PDO_FIREBIRD_TEST_DSN: firebird:dbname=localhost:test.fdb
services:
mysql:
image: mysql:8.4
Expand Down
87 changes: 87 additions & 0 deletions ext/opcache/tests/jit/gh24578.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
--TEST--
GH-24578 (Function JIT produces an incorrect result in a string-scanning loop)
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=64M
opcache.jit=function
--EXTENSIONS--
opcache
--FILE--
<?php
final class Repro {
public static function skipComment(string $sql, int $position): int {
$byte = $sql[$position];
$next = $sql[$position + 1] ?? '';
if ($byte === '/' && $next === '*') {
$end = strpos($sql, '*/', $position + 2);
return $end === false ? strlen($sql) : $end + 2;
}
$dashes = $byte === '-' && $next === '-' && strspn($sql[$position + 2] ?? "\n", " \t\r\n") === 1;
if ($byte !== '#' && !$dashes) {
return $position;
}
$end = strpos($sql, "\n", $position);
return $end === false ? strlen($sql) : $end + 1;
}

public static function skipQuoted(string $sql, int $position): int {
$quote = $sql[$position];
$length = strlen($sql);
$stops = $quote === '`' ? '`' : $quote . '\\';
$position++;
while ($position < $length) {
$position += strcspn($sql, $stops, $position);
if ($position >= $length) {
break;
}
if ($sql[$position] === '\\') {
$position += 2;
} elseif (($sql[$position + 1] ?? '') === $quote) {
$position += 2;
} else {
return $position + 1;
}
}
return $length;
}

public static function interpolate(string $sql, array $params): ?string {
$length = strlen($sql);
$count = count($params);
$text = '';
$used = 0;
$copied = 0;
$position = 0;
while ($position < $length) {
$position += strcspn($sql, "?'\"`#-/", $position);
if ($position >= $length) {
break;
}
$byte = $sql[$position];
if ($byte === '?') {
$text .= substr($sql, $copied, $position - $copied) . (string) $params[$used];
$used++;
$position++;
$copied = $position;
} elseif ($byte === "'" || $byte === '"' || $byte === '`') {
$position = self::skipQuoted($sql, $position);
} else {
$after = self::skipComment($sql, $position);
$position = $after === $position ? $position + 1 : $after;
}
}
return $used === $count ? $text . substr($sql, $copied) : null;
}
}

// A minus or slash without a following comment delimiter must not make the scanner stop.
var_dump(Repro::interpolate('SELECT ? AS v', [3]));
var_dump(Repro::interpolate('SELECT 5 -', []));
var_dump(Repro::interpolate('SELECT 5 / 2', []));
?>
--EXPECT--
string(13) "SELECT 3 AS v"
string(10) "SELECT 5 -"
string(12) "SELECT 5 / 2"
Loading