Skip to content
Merged
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
15 changes: 14 additions & 1 deletion .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,24 @@ jobs:
- sqlite
dependencies:
- highest
symfony-version:
- '*'
include:
- php-version: '8.0'
dependencies: lowest
symfony-version: '*'
db: sqlite
- php-version: '8.0'
dependencies: lowest
symfony-version: '5.*'
db: mysql
- php-version: '8.0'
dependencies: lowest
symfony-version: '5.*'
db: pgsql
- php-version: '8.5'
dependencies: lowest
symfony-version: '8.*'
db: pgsql

services:
Expand Down Expand Up @@ -73,13 +82,17 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
extensions: "pdo, pdo_sqlite, pdo_mysql, mysql, pdo_pgsql"
tools: 'composer:v2'
tools: 'composer:v2, flex'

- name: PHP 8.0 simple cache
# Symfony 5 is not compatible with SimpleCache 3 but does not declare a conflict. Symfony 6 can not be installed on PHP 8.0.
if: ${{ '8.0' == matrix.php-version }}
run: composer require psr/simple-cache "^2.0" --no-update

- name: Symfony version
if: matrix.symfony-version != '*'
run: composer config extra.symfony.require ${{ matrix.symfony-version }}

- name: Install dependencies with Composer
uses: ramsey/composer-install@v2
with:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

2.0.3
-----

* Allow installation with Symfony 8.
* Test with PHP 8.5.

2.0.2
-----

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"ext-simplexml": "*",
"psr/log": "^1 || ^2 || ^3",
"phpcr/phpcr-api-tests": "2.1.25",
"phpunit/phpunit": "^9.0",
"symfony/cache": "^5.4 || ^6.2 || ^7.0",
"phpunit/phpunit": "^9.6.16",
"symfony/cache": "^5.4 || ^6.2 || ^7.0 || ^8.0",
"phpstan/phpstan": "^2.0"
},
"autoload": {
Expand Down
20 changes: 18 additions & 2 deletions src/Jackalope/Transport/DoctrineDBAL/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ public function __construct(FactoryInterface $factory, Connection $conn)
*/
private function registerSqliteFunctions(\PDO $sqliteConnection): void
{
$sqliteConnection->sqliteCreateFunction(
$this->sqliteCreateFunction(
$sqliteConnection,
'EXTRACTVALUE',
function ($string, $expression) {
if (null === $string) {
Expand Down Expand Up @@ -208,14 +209,29 @@ function ($string, $expression) {
2
);

$sqliteConnection->sqliteCreateFunction(
$this->sqliteCreateFunction(
$sqliteConnection,
'CONCAT',
function () {
return implode('', func_get_args());
}
);
}

/**
* BC hack for PHP < 8.4. After that version we always talk with a \Pdo\Sqlite object.
*/
private function sqliteCreateFunction(\PDO $sqliteConnection, string $name, callable $function, int $numArgs = -1): void
{
if (class_exists(\Pdo\Sqlite::class) && $sqliteConnection instanceof \Pdo\Sqlite) {
$sqliteConnection->createFunction($name, $function, $numArgs);

return;
}

$sqliteConnection->sqliteCreateFunction($name, $function, $numArgs);
}

public function getConnection(): Connection
{
$this->initConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public function parse(): \stdClass
\xml_set_character_data_handler($parser, [$this, 'dataHandler']);

\xml_parse($parser, $this->xml, true);
\xml_parser_free($parser);
// avoid memory leaks and unset the parser see: https://www.php.net/manual/de/function.xml-parser-free.php
unset($parser);

return $this->data;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ public function removeProps(): array
\xml_set_character_data_handler($parser, [$this, 'dataHandler']);

\xml_parse($parser, $this->xml, true);
\xml_parser_free($parser);
// avoid memory leaks and unset the parser see: https://www.php.net/manual/de/function.xml-parser-free.php
unset($parser);

return [
$this->newXml.PHP_EOL,
Expand Down
7 changes: 6 additions & 1 deletion tests/Tools/Console/InitDoctrineDbalCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ public function setUp(): void
$this->application->setHelperSet($this->helperSet);

$command = new InitDoctrineDbalCommand();
$this->application->add($command);

if (method_exists($this->application, 'addCommand')) {
$this->application->addCommand($command);
} else {
$this->application->add($command);
}
}

/**
Expand Down
5 changes: 4 additions & 1 deletion tests/Transport/DoctrineDBAL/CachedClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ public function testDefaultKeySanitizer(): void
$client = $this->getClient($this->getConnection());
$reflection = new \ReflectionClass($client);
$keySanitizerProperty = $reflection->getProperty('keySanitizer');
$keySanitizerProperty->setAccessible(true);
// remove when we drop PHP 8.0 support
if (PHP_VERSION_ID < 80100) {
$keySanitizerProperty->setAccessible(true);
}
$defaultKeySanitizer = $keySanitizerProperty->getValue($client);

$result = $defaultKeySanitizer(' :{}().@/"\\'); // not allowed PSR16 keys
Expand Down
5 changes: 4 additions & 1 deletion tests/Transport/DoctrineDBAL/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,10 @@ public function testUuid(): void
{
$class = new \ReflectionClass(Client::class);
$method = $class->getMethod('generateUuid');
$method->setAccessible(true);
// remove when we drop PHP 8.0 support
if (PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}

self::assertIsString($method->invoke($this->transport));

Expand Down