Skip to content

Commit 0a50b38

Browse files
authored
Merge pull request GoogleCloudPlatform#526 from paumas/php-7.4
Adding version 7.4.12
2 parents a8f4b75 + d4a9236 commit 0a50b38

File tree

89 files changed

+2117
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2117
-35
lines changed

Diff for: builder/gen-dockerfile/src/Builder/GenFilesCommand.php

+13-5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ protected function configure()
5757
$this
5858
->setName('create')
5959
->setDescription('Create Dockerfile and .dockerignore file')
60+
->addOption(
61+
'php74-image',
62+
null,
63+
InputOption::VALUE_REQUIRED,
64+
'The PHP 74 base image of the Dockerfile'
65+
)
6066
->addOption(
6167
'php73-image',
6268
null,
@@ -111,17 +117,17 @@ protected function initialize(InputInterface $input, OutputInterface $output)
111117
$output->writeln("<info>
112118
There is no PHP runtime version specified in composer.json, or
113119
we don't support the version you specified. Google App Engine
114-
uses the latest 7.3.x version.
120+
uses the latest 7.4.x version.
115121
We recommend pinning your PHP version by running:
116122
117-
composer require php 7.3.* (replace it with your desired minor version)
123+
composer require php 7.4.* (replace it with your desired minor version)
118124
119-
Using PHP version 7.3.x...</info>
125+
Using PHP version 7.4.x...</info>
120126
");
121127
} elseif ($version === DetectPhpVersion::EXACT_VERSION_SPECIFIED) {
122128
throw new ExactVersionException(
123129
"An exact PHP version was specified in composer.json. Please pin your" .
124-
"PHP version to a minor version such as '7.3.*'."
130+
"PHP version to a minor version such as '7.4.*'."
125131
);
126132
}
127133
if (substr($version, 0, 3) === '5.6') {
@@ -132,8 +138,10 @@ protected function initialize(InputInterface $input, OutputInterface $output)
132138
$this->detectedPhpVersion = '7.1';
133139
} elseif (substr($version, 0, 3) === '7.2') {
134140
$this->detectedPhpVersion = '7.2';
135-
} else {
141+
} elseif (substr($version, 0, 3) === '7.3') {
136142
$this->detectedPhpVersion = '7.3';
143+
} else {
144+
$this->detectedPhpVersion = '7.4';
137145
}
138146
$yamlPath = getenv('GAE_APPLICATION_YAML_PATH')
139147
?: self::DEFAULT_YAML_PATH;

Diff for: builder/gen-dockerfile/src/DetectPhpVersion.php

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public static function isExactVersion($constraint)
9898
private static function detectAvailableVersions()
9999
{
100100
return [
101+
trim(file_get_contents('/opt/php74_version')),
101102
trim(file_get_contents('/opt/php73_version')),
102103
trim(file_get_contents('/opt/php72_version')),
103104
trim(file_get_contents('/opt/php71_version')),

Diff for: builder/gen-dockerfile/tests/GenFilesCommandTest.php

+31-16
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public function testGenFilesCommand(
7979
'--php71-image' => 'gcr.io/google-appengine/php71:latest',
8080
'--php72-image' => 'gcr.io/google-appengine/php72:latest',
8181
'--php73-image' => 'gcr.io/google-appengine/php73:latest',
82+
'--php74-image' => 'gcr.io/google-appengine/php74:latest',
8283
];
8384
}
8485
if ($expectedException !== null) {
@@ -131,10 +132,10 @@ public function dataProvider()
131132
'',
132133
'/app',
133134
'added by the php runtime builder',
134-
'gcr.io/google-appengine/php73:latest',
135+
'gcr.io/google-appengine/php74:latest',
135136
["COMPOSER_FLAGS='--no-dev --prefer-dist' \\\n",
136137
"FRONT_CONTROLLER_FILE='index.php' \\\n",
137-
"DETECTED_PHP_VERSION='7.3' \n"
138+
"DETECTED_PHP_VERSION='7.4' \n"
138139
]
139140
],
140141
[
@@ -144,11 +145,11 @@ public function dataProvider()
144145
'',
145146
'/app',
146147
'added by the php runtime builder',
147-
'gcr.io/google-appengine/php73:latest',
148+
'gcr.io/google-appengine/php74:latest',
148149
["COMPOSER_FLAGS='--no-dev --prefer-dist' \\\n",
149150
"FRONT_CONTROLLER_FILE='index.php' \\\n",
150151
"SKIP_LOCKDOWN_DOCUMENT_ROOT='true' \\\n",
151-
"DETECTED_PHP_VERSION='7.3' \n"
152+
"DETECTED_PHP_VERSION='7.4' \n"
152153
]
153154
],
154155
[
@@ -169,10 +170,10 @@ public function dataProvider()
169170
'',
170171
'/app',
171172
'added by the php runtime builder',
172-
'gcr.io/google-appengine/php73:latest',
173+
'gcr.io/google-appengine/php74:latest',
173174
["COMPOSER_FLAGS='--prefer-dist --no-dev --no-script' \\\n",
174175
"FRONT_CONTROLLER_FILE='index.php' \\\n",
175-
"DETECTED_PHP_VERSION='7.3' \n"
176+
"DETECTED_PHP_VERSION='7.4' \n"
176177
]
177178
],
178179
[
@@ -212,14 +213,27 @@ public function dataProvider()
212213
"DETECTED_PHP_VERSION='7.3' \n"
213214
]
214215
],
216+
[
217+
// PHP 7.4
218+
__DIR__ . '/test_data/php74',
219+
null,
220+
'',
221+
'/app',
222+
'added by the php runtime builder',
223+
'gcr.io/google-appengine/php74:latest',
224+
["COMPOSER_FLAGS='--no-dev --prefer-dist' \\\n",
225+
"FRONT_CONTROLLER_FILE='index.php' \\\n",
226+
"DETECTED_PHP_VERSION='7.4' \n"
227+
]
228+
],
215229
[
216230
// values on env_variables
217231
__DIR__ . '/test_data/values_only_on_env',
218232
null,
219233
'',
220234
'/app',
221235
'added by the php runtime builder',
222-
'gcr.io/google-appengine/php73:latest',
236+
'gcr.io/google-appengine/php74:latest',
223237
[
224238
"WHITELIST_FUNCTIONS='exec' \\\n",
225239
"FRONT_CONTROLLER_FILE='app.php'",
@@ -239,7 +253,7 @@ public function dataProvider()
239253
'',
240254
'/app',
241255
'added by the php runtime builder',
242-
'gcr.io/google-appengine/php73:latest',
256+
'gcr.io/google-appengine/php74:latest',
243257
[],
244258
'\\Google\\Cloud\\Runtimes\\Builder\\Exception\\MissingDocumentRootException'
245259
],
@@ -250,7 +264,7 @@ public function dataProvider()
250264
'',
251265
'/app',
252266
'added by the php runtime builder',
253-
'gcr.io/google-appengine/php73:latest',
267+
'gcr.io/google-appengine/php74:latest',
254268
[
255269
"WHITELIST_FUNCTIONS='exec' \\\n",
256270
"FRONT_CONTROLLER_FILE='app.php'",
@@ -271,7 +285,7 @@ public function dataProvider()
271285
'',
272286
'/app',
273287
'added by the php runtime builder',
274-
'gcr.io/google-appengine/php73:latest',
288+
'gcr.io/google-appengine/php74:latest',
275289
["FRONT_CONTROLLER_FILE='app.php' \\\n"]
276290
],
277291
[
@@ -281,7 +295,7 @@ public function dataProvider()
281295
'my.yaml',
282296
'/app',
283297
'added by the php runtime builder',
284-
'gcr.io/google-appengine/php73:latest'
298+
'gcr.io/google-appengine/php74:latest'
285299
],
286300
[
287301
// Overrides baseImage
@@ -292,11 +306,12 @@ public function dataProvider()
292306
'--php71-image' => 'gcr.io/php-mvm-a-28051/php71:latest',
293307
'--php72-image' => 'gcr.io/php-mvm-a-28051/php72:latest',
294308
'--php73-image' => 'gcr.io/php-mvm-a-28051/php73:latest',
309+
'--php74-image' => 'gcr.io/php-mvm-a-28051/php74:latest',
295310
],
296311
'',
297312
'/app',
298313
'added by the php runtime builder',
299-
'gcr.io/php-mvm-a-28051/php73:latest'
314+
'gcr.io/php-mvm-a-28051/php74:latest'
300315
],
301316
[
302317
// Has document_root set
@@ -305,7 +320,7 @@ public function dataProvider()
305320
'',
306321
'/app/web',
307322
'added by the php runtime builder',
308-
'gcr.io/google-appengine/php73:latest'
323+
'gcr.io/google-appengine/php74:latest'
309324
],
310325
[
311326
// Has document_root set in env_variables
@@ -314,7 +329,7 @@ public function dataProvider()
314329
'',
315330
'/app/web',
316331
'added by the php runtime builder',
317-
'gcr.io/google-appengine/php73:latest'
332+
'gcr.io/google-appengine/php74:latest'
318333
],
319334
[
320335
// document_root in both will throw exception
@@ -323,7 +338,7 @@ public function dataProvider()
323338
'',
324339
'/app/web',
325340
'added by the php runtime builder',
326-
'gcr.io/google-appengine/php73:latest',
341+
'gcr.io/google-appengine/php74:latest',
327342
[],
328343
'\\Google\\Cloud\\Runtimes\\Builder\\Exception\\EnvConflictException'
329344
],
@@ -343,7 +358,7 @@ public function dataProvider()
343358
'',
344359
'/app',
345360
'added by the php runtime builder',
346-
'gcr.io/google-appengine/php73:latest',
361+
'gcr.io/google-appengine/php74:latest',
347362
[],
348363
'\\Google\\Cloud\\Runtimes\\Builder\\Exception\\ExactVersionException'
349364
]
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
env: flex
2+
runtime: php
3+
4+
runtime_config:
5+
document_root: /app
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"php": "7.4.*"
4+
}
5+
}

Diff for: builder/php-latest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
steps:
22
- name: 'gcr.io/gcp-runtimes/php/gen-dockerfile:latest'
3-
args: ['--php73-image', 'gcr.io/google-appengine/php73:latest', '--php72-image', 'gcr.io/google-appengine/php72:latest', '--php71-image', 'gcr.io/google-appengine/php71:latest', '--php70-image', 'gcr.io/google-appengine/php70:latest', '--php56-image', 'gcr.io/google-appengine/php56:latest']
3+
args: ['--php74-image', 'gcr.io/google-appengine/php74:latest', '--php73-image', 'gcr.io/google-appengine/php73:latest', '--php72-image', 'gcr.io/google-appengine/php72:latest', '--php71-image', 'gcr.io/google-appengine/php71:latest', '--php70-image', 'gcr.io/google-appengine/php70:latest', '--php56-image', 'gcr.io/google-appengine/php56:latest']
44
env: 'GAE_APPLICATION_YAML_PATH=$_GAE_APPLICATION_YAML_PATH'
55
- name: 'gcr.io/kaniko-project/executor:v0.6.0'
66
args: ['--destination=$_OUTPUT_IMAGE']

Diff for: check-versions/tests/VersionTest.php

+19
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ public static function setUpBeforeClass()
4545
'Failed to detect the latest PHP73 version';
4646
}
4747

48+
$pattern = '/PHP (7\.4\.\d+)/';
49+
if (preg_match($pattern, $body, $matches)) {
50+
self::$versions['php74'] = $matches[1];
51+
} else {
52+
self::$versions['php74'] =
53+
'Failed to detect the latest PHP74 version';
54+
}
55+
4856
exec('apt-get update');
4957
}
5058

@@ -69,4 +77,15 @@ public function testPHP73Version()
6977
$this->fail('Failed to detect the current php73 version');
7078
}
7179
}
80+
81+
public function testPHP74Version()
82+
{
83+
$output = exec('apt-cache madison gcp-php74');
84+
$pattern = '/(7\.4\.\d+)/';
85+
if (preg_match($pattern, $output, $matches)) {
86+
$this->assertEquals($matches[1], self::$versions['php74']);
87+
} else {
88+
$this->fail('Failed to detect the current php74 version');
89+
}
90+
}
7291
}

Diff for: cloudbuild-ubuntu.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ steps:
2222
waitFor: ['php-base']
2323
id: php-base-structure
2424

25+
# php74
26+
- name: gcr.io/cloud-builders/docker
27+
args: ['build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74:$_TAG', '--build-arg', 'PHP_VERSION=7.4', '.']
28+
dir: php-versioned
29+
waitFor: ['php-base']
30+
id: php74
31+
- name: gcr.io/gcp-runtimes/structure_test
32+
args: ['-i', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74:$_TAG', '--config', '/workspace/php-versioned/php74.yaml', '-v']
33+
waitFor: ['php74']
34+
id: php74-structure
35+
2536
# php73
2637
- name: gcr.io/cloud-builders/docker
2738
args: ['build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/php73:$_TAG', '--build-arg', 'PHP_VERSION=7.3', '.']
@@ -126,6 +137,24 @@ steps:
126137
waitFor: ['php71-custom-app', 'test-runner']
127138
id: php71-custom-test
128139

140+
# php74-custom test
141+
- name: gcr.io/cloud-builders/docker
142+
args: ['build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74-custom:$_TAG', '.']
143+
dir: testapps/php74_custom
144+
waitFor: ['php-onbuild']
145+
id: php74-custom-build
146+
- name: gcr.io/gcp-runtimes/structure_test
147+
args: ['-i', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74-custom:$_TAG', '--config', 'php74.yaml', '-v']
148+
waitFor: ['php74-custom-build']
149+
- name: gcr.io/cloud-builders/docker
150+
args: ['run', '--net=nw_$_TAG', '--name=php74-custom', '-d', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74-custom:$_TAG']
151+
waitFor: ['php74-custom-build', 'test-network']
152+
id: php74-custom-app
153+
- name: gcr.io/cloud-builders/docker
154+
args: ['run', '--net=nw_$_TAG','-v', '/workspace:/workspace', 'gcr.io/${_GOOGLE_PROJECT_ID}/php-test-runner:$_TAG', '/workspace/testapps/php74_custom/tests']
155+
waitFor: ['php74-custom-app', 'test-runner']
156+
id: php74-custom-test
157+
129158
# php73-custom test
130159
- name: gcr.io/cloud-builders/docker
131160
args: ['build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/php73-custom:$_TAG', '.']
@@ -222,9 +251,35 @@ steps:
222251
waitFor: ['php73-extensions-build']
223252
id: php73-extensions-legacy-test
224253

254+
# php74-extensions test
255+
- name: gcr.io/cloud-builders/docker
256+
args: [ 'build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74-extensions:$_TAG', '.' ]
257+
dir: testapps/php74_extensions
258+
waitFor: [ 'php-onbuild' ]
259+
id: php74-extensions-build
260+
- name: gcr.io/cloud-builders/docker
261+
args: [ 'run', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74-extensions:$_TAG', 'vendor/bin/phpunit' ]
262+
dir: testapps/php74_extensions
263+
waitFor: [ 'php74-extensions-build' ]
264+
id: php74-extensions-test
265+
266+
# php74-extensions-legacy test
267+
- name: gcr.io/cloud-builders/docker
268+
args: [ 'build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74-extensions:$_TAG', '.' ]
269+
dir: testapps/php74_extensions_legacy
270+
waitFor: [ 'php-onbuild' ]
271+
id: php74-extensions-legacy-build
272+
- name: gcr.io/cloud-builders/docker
273+
args: [ 'run', 'gcr.io/${_GOOGLE_PROJECT_ID}/php74-extensions:$_TAG', 'vendor/bin/phpunit' ]
274+
dir: testapps/php74_extensions_legacy
275+
waitFor: [ 'php74-extensions-build' ]
276+
id: php74-extensions-legacy-test
277+
278+
225279
images:
226280
- gcr.io/${_GOOGLE_PROJECT_ID}/php-base:$_TAG
227281
- gcr.io/${_GOOGLE_PROJECT_ID}/php:$_TAG
282+
- gcr.io/${_GOOGLE_PROJECT_ID}/php74:$_TAG
228283
- gcr.io/${_GOOGLE_PROJECT_ID}/php73:$_TAG
229284
- gcr.io/${_GOOGLE_PROJECT_ID}/php72:$_TAG
230285
- gcr.io/${_GOOGLE_PROJECT_ID}/php71:$_TAG

Diff for: integration-tests.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ steps:
66
waitFor: ['-']
77
id: test-runner
88

9+
# php74_e2e test
10+
- name: gcr.io/${_GOOGLE_PROJECT_ID}/php-test-runner:$_TAG
11+
args: ['/workspace/testapps/php74_e2e/tests']
12+
waitFor: ['test-runner']
13+
id: php74_e2e
14+
env:
15+
- 'SERVICE_ACCOUNT_JSON=${_SERVICE_ACCOUNT_JSON}'
16+
- 'TAG=${_TAG}-e2e'
17+
- 'E2E_PROJECT_ID=${_E2E_PROJECT_ID}'
18+
- 'TEST_VM_IMAGE=${_TEST_VM_IMAGE}'
19+
920
# php73_e2e test
1021
- name: gcr.io/${_GOOGLE_PROJECT_ID}/php-test-runner:$_TAG
1122
args: ['/workspace/testapps/php73_e2e/tests']

Diff for: package-builder/debian/patches/php74-parse_str_harden.patch

Whitespace-only changes.

0 commit comments

Comments
 (0)