Merge pull request #9110 from open-sausages/pulls/3.7/boldy-into-the-php74-futur-goes-silverstripe-iii

BUG Require a PHP7.4 compatible fork of phpunit-mock-objects
This commit is contained in:
Robbie Averill 2019-07-19 14:38:41 +02:00 committed by GitHub
commit 8c41dbb8b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 4 deletions

View File

@ -32,7 +32,7 @@ matrix:
env: DB=SQLITE
- php: 7.4snapshot
env: DB=SQLITE
env: DB=SQLITE INSTALL_PHPUNIT_FORK=1
# CMS test
- php: 5.5
@ -58,6 +58,7 @@ before_script:
- if ! [ $(phpenv version-name) = "5.3" ]; then printf "\n" | travis_retry pecl install imagick; fi
- if [ $(phpenv version-name) = "5.3" ]; then printf "\n" | travis_retry pecl install imagick-3.3.0; fi
- composer self-update || true
- if [ $INSTALL_PHPUNIT_FORK ]; then composer require --no-update --dev sminnee/phpunit-mock-objects:^3.4.7; fi
- phpenv rehash
- phpenv config-rm xdebug.ini || true
- echo 'memory_limit = 3G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

View File

@ -25,7 +25,7 @@
},
"require-dev": {
"phpunit/phpunit": "^3 || ^4 || ^5"
},
},
"extra": [],
"autoload": {
"psr-0": {
@ -63,4 +63,4 @@
"core/compat"
]
}
}
}

View File

@ -0,0 +1,19 @@
# 3.7.4 (unreleased)
* [Minor update to support PHP 7.4](https://github.com/silverstripe/silverstripe-framework/pull/9110)
## Running SilverStripe 3.7 on PHP 7.4
SilverStripe's standard test tools require `phpunit/phpunit-mock-objects` to run. This package has been deprecated and
doesn't support PHP 7.4.
SilverStripe is using a fork for its own PHP 7.3 unit tests: `sminnee/phpunit-mock-objects`.
You can use this fork for your own project by running this command:
```bash
composer require --dev sminnee/phpunit-mock-objects:^3.4.7
```
This fork is not a supported module and SilverStripe does not commit to maintaining it.
<!--- Changes below this line will be automatically regenerated -->

View File

@ -140,7 +140,11 @@ class GDBackend extends SS_Object implements Image_Backend {
$bytesPerPixel = $bits * $channels;
// width * height * bytes per pixel
$memoryRequired = $imageInfo[0] * $imageInfo[1] * $bytesPerPixel;
if ($imageInfo) {
$memoryRequired = $imageInfo[0] * $imageInfo[1] * $bytesPerPixel;
} else {
$memoryRequired = 0;
}
return $memoryRequired + memory_get_usage() < $limit;
}