Skip to content

Commit

Permalink
Merge pull request #298 from symbiote/feature-php-7-4
Browse files Browse the repository at this point in the history
Remove depreciated syntax for string subscript
  • Loading branch information
Nathan authored Jun 9, 2020
2 parents aabfab5 + c91e8ef commit 9cf96b2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
26 changes: 14 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details
# See https://github.com/silverstripe/silverstripe-travis-support for setup details

sudo: false
dist: trusty

language: php

matrix:
include:
- php: 5.6
env: DB=MYSQL CORE_RELEASE=3
- php: 5.6
env: DB=MYSQL CORE_RELEASE=3.1
- php: 5.6
env: DB=PGSQL CORE_RELEASE=3.2
- php: 7.0
env: DB=MYSQL CORE_RELEASE=3.6
- php: 7.1
- php: '5.6'
env: DB=MYSQL CORE_RELEASE=3.6
- php: '7.0'
env: DB=MYSQL CORE_RELEASE=3.7
- php: '7.1'
env: DB=PGSQL CORE_RELEASE=3.7
- php: '7.2'
env: DB=MYSQL CORE_RELEASE=3.7
- php: '7.3'
env: DB=MYSQL CORE_RELEASE=3.7
- php: '7.4'
env: DB=MYSQL CORE_RELEASE=3.7

before_script:
- composer self-update || true
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss
- composer install
Expand Down
4 changes: 4 additions & 0 deletions _config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

// Ensure compatibility with PHP 7.2 ("object" is a reserved word),
// with SilverStripe 3.6 (using Object) and SilverStripe 3.7 (using SS_Object)
if (!class_exists('SS_Object')) class_alias('Object', 'SS_Object');

if (($QUEUED_JOBS_DIR = basename(dirname(__FILE__))) != 'queuedjobs') {
die("The queued jobs module must be installed in /queuedjobs, not $QUEUED_JOBS_DIR");
}
2 changes: 1 addition & 1 deletion code/dataobjects/QueuedJobDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function activateOnQueue() {
protected function getJobDir() {
// make sure our temp dir is in place. This is what will be inotify watched
$jobDir = Config::inst()->get('QueuedJobService', 'cache_dir');
if ($jobDir{0} != '/') {
if ($jobDir[0] != '/') {
$jobDir = TEMP_FOLDER . '/' . $jobDir;
}

Expand Down
12 changes: 7 additions & 5 deletions code/services/QueuedJobService.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ protected function restartStalledJob($stalledJob) {
protected function initialiseJob(QueuedJobDescriptor $jobDescriptor) {
// create the job class
$impl = $jobDescriptor->Implementation;
$job = Object::create($impl);
$job = SS_Object::create($impl);
/* @var $job QueuedJob */
if (!$job) {
throw new Exception("Implementation $impl no longer exists");
Expand Down Expand Up @@ -919,7 +919,7 @@ public function clear() {
/**
* For logging and catching exceptions thrown during AbstractQueuedJob::process()
* and similar.
*/
*/
public function handleException($exception) {
$errno = E_USER_ERROR;
$type = get_class($exception);
Expand All @@ -935,8 +935,10 @@ public function handleException($exception) {
/**
* Works like the core Silverstripe error handler without exiting
* on fatal messages.
*/
*/
public function handleError($errno, $errstr, $errfile, $errline) {
$trace = debug_backtrace();

if (error_reporting()) {
// Don't throw E_DEPRECATED in PHP 5.3+
/*if (defined('E_DEPRECATED')) {
Expand All @@ -951,14 +953,14 @@ public function handleError($errno, $errstr, $errfile, $errline) {
case E_DEPRECATED:
case E_USER_DEPRECATED:
case E_STRICT:
Debug::noticeHandler($errno, $errstr, $errfile, $errline, debug_backtrace());
Debug::noticeHandler($errno, $errstr, $errfile, $errline, $trace);
break;

case E_WARNING:
case E_CORE_WARNING:
case E_USER_WARNING:
case E_RECOVERABLE_ERROR:
Debug::warningHandler($errno, $errstr, $errfile, $errline, debug_backtrace());
Debug::warningHandler($errno, $errstr, $errfile, $errline, $trace);
break;

default:
Expand Down

0 comments on commit 9cf96b2

Please sign in to comment.