From cc816bcb84984145630e0f0e81ec4362fd09e09b Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 21 Jun 2026 20:07:28 +0200 Subject: [PATCH 1/5] Refactor I/O exceptions --- .github/workflows/ci.yml | 2 +- composer.json | 4 ++-- src/main/php/rdbms/mysqlx/MySqlxConnection.class.php | 10 +++++----- src/main/php/rdbms/mysqlx/MySqlxProtocol.class.php | 4 ++-- src/main/php/rdbms/mysqlx/NamedPipe.class.php | 4 ++-- src/main/php/rdbms/tds/TdsConnection.class.php | 10 +++++----- src/main/php/rdbms/tds/TdsProtocol.class.php | 6 +++--- src/main/php/rdbms/tds/TdsV5Protocol.class.php | 2 +- src/main/php/rdbms/tds/TdsV7Protocol.class.php | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89392752..e685d4c2 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: - name: Install dependencies run: > - curl -sSL https://baltocdn.com/xp-framework/xp-runners/distribution/downloads/e/entrypoint/xp-run-8.8.0.sh > xp-run && + curl -sSL https://github.com/xp-runners/reference/releases/download/v9.2.0/xp-run-9.2.0.sh > xp-run && composer install --prefer-dist && echo "vendor/autoload.php" > composer.pth diff --git a/composer.json b/composer.json index 076df24e..512f5005 100755 --- a/composer.json +++ b/composer.json @@ -6,9 +6,9 @@ "description" : "RDBMS support for the XP Framework", "keywords": ["module", "xp"], "require" : { - "xp-framework/core": "^12.0 | ^11.0 | ^10.0 | ^9.0 | ^8.0 | ^7.0", + "xp-framework/core": "^12.11 | ^11.11", "xp-framework/logging": "^11.0 | ^10.0 | ^9.0 | ^8.0 | ^7.0", - "xp-framework/networking": "^10.0 | ^9.0 | ^8.0 | ^7.0", + "xp-framework/networking": "^11.0 | ^10.0 | ^9.3", "xp-framework/math": "^10.0 | ^9.0 | ^8.0 | ^7.0", "php" : ">=7.0.0" }, diff --git a/src/main/php/rdbms/mysqlx/MySqlxConnection.class.php b/src/main/php/rdbms/mysqlx/MySqlxConnection.class.php index 11ce1c31..b6440a46 100755 --- a/src/main/php/rdbms/mysqlx/MySqlxConnection.class.php +++ b/src/main/php/rdbms/mysqlx/MySqlxConnection.class.php @@ -1,6 +1,6 @@ handle->connect($this->dsn->getUser(), $this->dsn->getPassword()); $this->_obs && $this->notifyObservers(new DBEvent(DBEvent::CONNECTED, $reconnect)); - } catch (IOException $e) { + } catch (OperationFailed $e) { $this->handle->connected= null; $this->_obs && $this->notifyObservers(new DBEvent(DBEvent::CONNECTED, $reconnect)); throw new SQLConnectException($e->getMessage(), $this->dsn); @@ -84,7 +84,7 @@ public function connect($reconnect= false) { // "modes is a list of different modes separated by comma (,) characters." $query= $this->handle->consume($this->handle->query("show variables like 'sql_mode'")); $modes= array_flip(explode(',', $query[0][1])); - } catch (IOException $e) { + } catch (OperationFailed $e) { // Ignore } @@ -121,7 +121,7 @@ public function selectdb($db) { try { $this->handle->exec('use '.$db); return true; - } catch (IOException $e) { + } catch (OperationFailed $e) { throw new SQLStatementFailedException($e->getMessage()); } } @@ -176,7 +176,7 @@ protected function query0($sql, $buffered= true) { default: throw new SQLStatementFailedException($message, $sql, $e->error); } - } catch (IOException $e) { + } catch (OperationFailed $e) { $this->close(); $this->transaction= 0; throw new SQLConnectionClosedException($e->getMessage(), $tries, $sql, -1); diff --git a/src/main/php/rdbms/mysqlx/MySqlxProtocol.class.php b/src/main/php/rdbms/mysqlx/MySqlxProtocol.class.php index 97a27a4f..8df5f687 100755 --- a/src/main/php/rdbms/mysqlx/MySqlxProtocol.class.php +++ b/src/main/php/rdbms/mysqlx/MySqlxProtocol.class.php @@ -72,7 +72,7 @@ public function __construct(Socket $s) { * * @param string user * @param string user - * @throws io.IOException + * @throws io.OperationFailed */ public function connect($user= '', $password= '') { $this->sock->isConnected() || $this->sock->connect(); @@ -159,7 +159,7 @@ public function close() { try { $this->write(chr(self::COM_QUIT)); - } catch (\io\IOException $ignored) { + } catch (\io\OperationFailed $ignored) { // Can't do much here } $this->sock->close(); diff --git a/src/main/php/rdbms/mysqlx/NamedPipe.class.php b/src/main/php/rdbms/mysqlx/NamedPipe.class.php index 740225ae..feda98da 100755 --- a/src/main/php/rdbms/mysqlx/NamedPipe.class.php +++ b/src/main/php/rdbms/mysqlx/NamedPipe.class.php @@ -1,6 +1,6 @@ locate(); if (!($fd= fopen($socket, 'r+'))) { - $e= new IOException('Cannot open pipe "'.$socket.'"'); + $e= new OperationFailed('Cannot open pipe "'.$socket.'"'); \xp::gc(__FILE__); throw $e; } diff --git a/src/main/php/rdbms/tds/TdsConnection.class.php b/src/main/php/rdbms/tds/TdsConnection.class.php index 816658c7..ab21ad4e 100755 --- a/src/main/php/rdbms/tds/TdsConnection.class.php +++ b/src/main/php/rdbms/tds/TdsConnection.class.php @@ -1,9 +1,9 @@ handle->connect($this->dsn->getUser(), $this->dsn->getPassword(), $this->dsn->getProperty('charset', null)); $this->_obs && $this->notifyObservers(new DBEvent(DBEvent::CONNECTED, $reconnect)); - } catch (IOException $e) { + } catch (OperationFailed $e) { $this->handle->connected= null; $this->_obs && $this->notifyObservers(new DBEvent(DBEvent::CONNECTED, $reconnect)); $message= ''; @@ -91,7 +91,7 @@ public function selectdb($db) { try { $this->handle->exec('use '.$db); return true; - } catch (IOException $e) { + } catch (OperationFailed $e) { throw new SQLStatementFailedException($e->getMessage()); } } @@ -131,7 +131,7 @@ protected function query0($sql, $buffered= true) { default: // Other error throw new SQLStatementFailedException($message, $sql, $e->number); } - } catch (IOException $e) { + } catch (OperationFailed $e) { if (0 === $this->transaction && $this->connections->retry($this, $tries)) { $tries++; goto retry; diff --git a/src/main/php/rdbms/tds/TdsProtocol.class.php b/src/main/php/rdbms/tds/TdsProtocol.class.php index 4eedd036..f33053ec 100755 --- a/src/main/php/rdbms/tds/TdsProtocol.class.php +++ b/src/main/php/rdbms/tds/TdsProtocol.class.php @@ -327,7 +327,7 @@ protected abstract function defaultPacketSize(); * * @param string user * @param string password - * @throws io.IOException + * @throws io.OperationFailed */ protected abstract function login($user, $password); @@ -472,7 +472,7 @@ protected function handleEnvChange($type, $old, $new, $initial= false) { * @param string user * @param string password * @param string charset - * @throws io.IOException + * @throws io.OperationFailed */ public function connect($user= '', $password= '', $charset= null) { $this->connected= false; @@ -661,7 +661,7 @@ public function close() { try { $this->stream->write(self::MSG_LOGOFF, "\0"); - } catch (\io\IOException $ignored) { + } catch (\io\OperationFailed $ignored) { // Can't do much here } diff --git a/src/main/php/rdbms/tds/TdsV5Protocol.class.php b/src/main/php/rdbms/tds/TdsV5Protocol.class.php index 4f59a8c8..a1dc28e3 100755 --- a/src/main/php/rdbms/tds/TdsV5Protocol.class.php +++ b/src/main/php/rdbms/tds/TdsV5Protocol.class.php @@ -119,7 +119,7 @@ protected function defaultPacketSize() { return 512; } * @param string user * @param string password * @param string charset - * @throws io.IOException + * @throws io.OperationFailed */ protected function login($user, $password, $charset= null) { if (strlen($password) > 253) { diff --git a/src/main/php/rdbms/tds/TdsV7Protocol.class.php b/src/main/php/rdbms/tds/TdsV7Protocol.class.php index a347a6af..3c160d8f 100755 --- a/src/main/php/rdbms/tds/TdsV7Protocol.class.php +++ b/src/main/php/rdbms/tds/TdsV7Protocol.class.php @@ -156,7 +156,7 @@ protected function defaultPacketSize() { return 4096; } * @param string user * @param string password * @param string charset - * @throws io.IOException + * @throws io.OperationFailed */ protected function login($user, $password, $charset= null) { $params= [ From ca2fbd6ebcaab3002786180ebbf0160e931cf0c2 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 21 Jun 2026 20:09:10 +0200 Subject: [PATCH 2/5] Add PHP 8.6, use XP Runners from GitHub --- .github/workflows/ci.yml | 6 +++--- appveyor.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e685d4c2..46705e06 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,11 @@ jobs: if: "!contains(github.event.head_commit.message, 'skip ci')" name: PHP ${{ matrix.php-versions }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.php-versions >= '8.5' }} + continue-on-error: ${{ matrix.php-versions >= '8.6' }} strategy: fail-fast: false matrix: - php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] + php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6'] os: [ubuntu-latest, windows-latest] steps: @@ -49,7 +49,7 @@ jobs: - name: Install dependencies run: > - curl -sSL https://github.com/xp-runners/reference/releases/download/v9.2.0/xp-run-9.2.0.sh > xp-run && + curl -sSL https://github.com/xp-runners/reference/releases/download/v9.3.0/xp-run-9.3.0.sh > xp-run && composer install --prefer-dist && echo "vendor/autoload.php" > composer.pth diff --git a/appveyor.yml b/appveyor.yml index f91889e5..354550e4 100755 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,9 +13,9 @@ init: install: - if exist .\xp (set CACHED=1) else (mkdir .\xp) - if %CACHED%==0 cd .\xp - - if %CACHED%==0 curl -fsS -o php.zip https://windows.php.net/downloads/releases/archives/php-8.2.15-nts-Win32-vs16-x64.zip + - if %CACHED%==0 curl -fsS -o php.zip https://downloads.php.net/~windows/releases/archives/php-8.4.22-Win32-vs17-x64.zip - if %CACHED%==0 appveyor DownloadFile https://getcomposer.org/composer.phar - - if %CACHED%==0 appveyor DownloadFile https://baltocdn.com/xp-framework/xp-runners/distribution/downloads/z/zip/xp-runners_8.8.0.zip -FileName xp.zip + - if %CACHED%==0 appveyor DownloadFile https://github.com/xp-runners/reference/releases/download/v9.3.0/xp-runners_9.3.0.zip -FileName xp.zip - if %CACHED%==0 7z x php.zip -y - if %CACHED%==0 7z x xp.zip -y - if %CACHED%==0 cd .. From 04da8e2fe88c36cc9c4659b8ca686913b11b7e62 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 21 Jun 2026 20:18:30 +0200 Subject: [PATCH 3/5] Use VS16 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 354550e4..379b6ea4 100755 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,7 @@ init: install: - if exist .\xp (set CACHED=1) else (mkdir .\xp) - if %CACHED%==0 cd .\xp - - if %CACHED%==0 curl -fsS -o php.zip https://downloads.php.net/~windows/releases/archives/php-8.4.22-Win32-vs17-x64.zip + - if %CACHED%==0 curl -fsS -o php.zip https://downloads.php.net/~windows/releases/archives/php-8.3.31-nts-Win32-vs16-x86.zip - if %CACHED%==0 appveyor DownloadFile https://getcomposer.org/composer.phar - if %CACHED%==0 appveyor DownloadFile https://github.com/xp-runners/reference/releases/download/v9.3.0/xp-runners_9.3.0.zip -FileName xp.zip - if %CACHED%==0 7z x php.zip -y From 7871adee9df8bff104ceb6940ad0fa4c23cbe62d Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 21 Jun 2026 20:22:39 +0200 Subject: [PATCH 4/5] Downgrade to PHP 8.2 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 379b6ea4..541db624 100755 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,7 @@ init: install: - if exist .\xp (set CACHED=1) else (mkdir .\xp) - if %CACHED%==0 cd .\xp - - if %CACHED%==0 curl -fsS -o php.zip https://downloads.php.net/~windows/releases/archives/php-8.3.31-nts-Win32-vs16-x86.zip + - if %CACHED%==0 curl -fsS -o php.zip https://downloads.php.net/~windows/releases/archives/php-8.2.31-nts-Win32-vs16-x86.zip - if %CACHED%==0 appveyor DownloadFile https://getcomposer.org/composer.phar - if %CACHED%==0 appveyor DownloadFile https://github.com/xp-runners/reference/releases/download/v9.3.0/xp-runners_9.3.0.zip -FileName xp.zip - if %CACHED%==0 7z x php.zip -y From 82e14bc6f7c105407b1abf01c0114a13d7b0da9a Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 21 Jun 2026 20:26:24 +0200 Subject: [PATCH 5/5] Revert back to older PHP --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 541db624..3414bef0 100755 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,7 @@ init: install: - if exist .\xp (set CACHED=1) else (mkdir .\xp) - if %CACHED%==0 cd .\xp - - if %CACHED%==0 curl -fsS -o php.zip https://downloads.php.net/~windows/releases/archives/php-8.2.31-nts-Win32-vs16-x86.zip + - if %CACHED%==0 curl -fsS -o php.zip https://downloads.php.net/~windows/releases/archives/php-8.2.15-nts-Win32-vs16-x86.zip - if %CACHED%==0 appveyor DownloadFile https://getcomposer.org/composer.phar - if %CACHED%==0 appveyor DownloadFile https://github.com/xp-runners/reference/releases/download/v9.3.0/xp-runners_9.3.0.zip -FileName xp.zip - if %CACHED%==0 7z x php.zip -y