FIX: Stricter regex syntax for PHP7.3 support.

This commit is contained in:
Sam Minnee 2018-10-02 12:55:49 +13:00
parent 46d8aad91a
commit d6117630bd
2 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ function getTempFolder($base = null) {
$parent = getTempParentFolder($base);
// The actual temp folder is a subfolder of getTempParentFolder(), named by username and suffixed with currently used php-version
$phpversion = '-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
$phpversion = '-php' . preg_replace('/[^\w\-\.+]+/', '-', PHP_VERSION);
$subfolder = $parent . DIRECTORY_SEPARATOR . getTempFolderUsername() . $phpversion;
if(!@file_exists($subfolder)) {

View File

@ -17,7 +17,7 @@ class CoreTest extends SapphireTest {
public function testGetTempPathInProject() {
$user = getTempFolderUsername();
$phpversion = '-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
$phpversion = '-php' . preg_replace('/[^\w\-\.+]+/', '-', PHP_VERSION);
if(file_exists($this->tempPath)) {
$this->assertEquals(getTempFolder(BASE_PATH), $this->tempPath . DIRECTORY_SEPARATOR . $user . $phpversion);
} else {
@ -43,9 +43,9 @@ class CoreTest extends SapphireTest {
public function tearDown() {
parent::tearDown();
$user = getTempFolderUsername();
$phpversion = '-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
$phpversion = '-php' . preg_replace('/[^\w\-\.+]+/', '-', PHP_VERSION);
$base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache' . $phpversion;
foreach(array(
'C--inetpub-wwwroot-silverstripe-test-project',
'-Users-joebloggs-Sites-silverstripe-test-project',