Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX PDO transaction in PHP 8, add GitHub Actions CI #10360

Merged
merged 1 commit into from
Jun 27, 2022
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
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:
# Every Tuesday at 2:20pm UTC
schedule:
- cron: '20 14 * * 2'
GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved

jobs:
ci:
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
# Turn phpcoverage off because it causes a segfault
phpcoverage_force_off: true
# There is a strange behat.yml file in framework that runs behat tests in the admin module
endtoend: false
15 changes: 15 additions & 0 deletions .github/workflows/keepalive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Keepalive

on:
# The 4th of every month at 10:50am UTC
schedule:
GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved
- cron: '50 10 4 * *'
workflow_dispatch:

jobs:
keepalive:
name: Keepalive
runs-on: ubuntu-latest
steps:
- name: Keepalive
uses: silverstripe/gha-keepalive@v1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Silverstripe Framework

[![Build Status](https://api.travis-ci.com/silverstripe/silverstripe-framework.svg?branch=4)](https://travis-ci.com/silverstripe/silverstripe-framework)
[![CI](https://github.com/silverstripe/silverstripe-framework/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-framework/actions/workflows/ci.yml)
[![Build Docs](https://github.com/silverstripe/silverstripe-framework/workflows/Build%20Docs/badge.svg)](https://docs.silverstripe.org/)
[![Latest Stable Version](https://poser.pugx.org/silverstripe/framework/version.svg)](https://www.silverstripe.org/stable-download/)
[![Latest Unstable Version](https://poser.pugx.org/silverstripe/framework/v/unstable.svg)](https://packagist.org/packages/silverstripe/framework)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"psr/container": "^1",
"silverstripe/config": "^1@dev",
"silverstripe/assets": "^1@dev",
"silverstripe/vendor-plugin": "^1.4",
"silverstripe/vendor-plugin": "^1.6",
"sminnee/callbacklist": "^0.1",
"swiftmailer/swiftmailer": "^6.2",
"symfony/cache": "^3.4 || ^4.0",
Expand Down
11 changes: 10 additions & 1 deletion src/ORM/Connect/PDOConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PDO;
use PDOStatement;
use InvalidArgumentException;
use PDOException;

/**
* PDO driver database connector
Expand Down Expand Up @@ -558,7 +559,15 @@ public function transactionRollback($savepoint = null)
}

$this->inTransaction = false;
return $this->pdoConnection->rollBack();
try {
return $this->pdoConnection->rollBack();
} catch (PDOException $e) {
// A PDOException will be thrown if there is no active transaction in PHP 8+
// Prior to PHP 8, this failed silently, so returning false here is backwards compatible
// Note: $this->inTransaction may not match the 'in-transaction' state in PDO
// https://www.php.net/manual/en/pdo.rollback.php
return false;
}
}

public function transactionDepth()
Expand Down