Skip to content

Commit a274791

Browse files
bshafferkennethye1
authored andcommitted
feat: upgrade all instances of PHP 7.4 and 8.0 to 8.1 or higher (GoogleCloudPlatform#1963)
1 parent 76573e0 commit a274791

Some content is hidden

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

43 files changed

+117
-118
lines changed

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Install PHP
1414
uses: shivammathur/setup-php@v2
1515
with:
16-
php-version: '8.0'
16+
php-version: '8.2'
1717

1818
- name: Run Script
1919
run: testing/run_cs_check.sh
@@ -25,7 +25,7 @@ jobs:
2525
- name: Install PHP
2626
uses: shivammathur/setup-php@v2
2727
with:
28-
php-version: '8.0'
28+
php-version: '8.2'
2929
- name: Get changed files
3030
id: changedFiles
3131
uses: tj-actions/changed-files@v44

.kokoro/deploy_gae.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-kokoro-resources/php80"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/php81"
77
}
88

99
# Run the deployment tests

.kokoro/deploy_gcf.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-kokoro-resources/php80"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/php81"
77
}
88

99
# Run the deployment tests

.kokoro/deploy_misc.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-kokoro-resources/php80"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/php81"
77
}
88

99
# Run the deployment tests

.kokoro/php80.cfg renamed to .kokoro/php83.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-kokoro-resources/php80"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/php83"
77
}
88

99
# Give the docker image a unique project ID and credentials per PHP version

.kokoro/php_rest.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Configure the docker image for kokoro-trampoline.
44
env_vars: {
55
key: "TRAMPOLINE_IMAGE"
6-
value: "gcr.io/cloud-devrel-kokoro-resources/php80"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/php81"
77
}
88

99
# Set this project to run REST tests only
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Getting Started on App Engine for PHP 7.4
1+
# Getting Started on App Engine for PHP 8.1
22

33
This sample demonstrates how to deploy a PHP application which integrates with
4-
Cloud SQL and Cloud Storage on App Engine Standard for PHP 7.4. The tutorial
4+
Cloud SQL and Cloud Storage on App Engine Standard for PHP 8.1. The tutorial
55
uses the Slim framework.
66

7-
## View the [full tutorial](https://cloud.google.com/appengine/docs/standard/php7/building-app/)
7+
## View the [full tutorial](https://cloud.google.com/appengine/docs/standard/php-gen2/building-app)

appengine/standard/slim-framework/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Slim Framework on App Engine for PHP 7.4
1+
# Slim Framework on App Engine for PHP
22

33
This sample demonstrates how to deploy a *very* basic [Slim][slim] application to
4-
[Google App Engine for PHP 7.4][appengine-php]. For a more complete guide, follow
4+
[Google App Engine for PHP][appengine-php]. For a more complete guide, follow
55
the [Building an App][building-an-app] tutorial.
66

77
## Setup
@@ -34,7 +34,7 @@ The application consists of three components:
3434
3. An [`index.php`](index.php) which handles all the requests which get routed to your app.
3535

3636
The `index.php` file is the most important. All applications running on App Engine
37-
for PHP 7.4 require use of a [front controller][front-controller] file.
37+
for PHP require use of a [front controller][front-controller] file.
3838

3939
[console]: https://console.developers.google.com/project
4040
[slim]: https://www.slimframework.com/

appengine/standard/slim-framework/phpunit.xml.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
-->
1717
<phpunit bootstrap="../../../testing/bootstrap.php">
1818
<testsuites>
19-
<testsuite name="AppEngine for PHP 7.4 Slim Framework test">
19+
<testsuite name="AppEngine for PHP Slim Framework test">
2020
<directory>test</directory>
2121
</testsuite>
2222
</testsuites>

bigtable/src/update_app_profile.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function update_app_profile(
9090
if ($operationResponse->operationSucceeded()) {
9191
$updatedAppProfile = $operationResponse->getResult();
9292
printf('App profile updated: %s' . PHP_EOL, $updatedAppProfile->getName());
93-
// doSomethingWith($updatedAppProfile)
93+
// doSomethingWith($updatedAppProfile)
9494
} else {
9595
$error = $operationResponse->getError();
9696
// handleError($error)

bigtable/src/update_cluster.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function update_cluster(
5555
if ($operationResponse->operationSucceeded()) {
5656
$updatedCluster = $operationResponse->getResult();
5757
printf('Cluster updated with the new num of nodes: %s.' . PHP_EOL, $updatedCluster->getServeNodes());
58-
// doSomethingWith($updatedCluster)
58+
// doSomethingWith($updatedCluster)
5959
} else {
6060
$error = $operationResponse->getError();
6161
// handleError($error)

bigtable/src/update_instance.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function update_instance(
7373
if ($operationResponse->operationSucceeded()) {
7474
$updatedInstance = $operationResponse->getResult();
7575
printf('Instance updated with the new display name: %s.' . PHP_EOL, $updatedInstance->getDisplayName());
76-
// doSomethingWith($updatedInstance)
76+
// doSomethingWith($updatedInstance)
7777
} else {
7878
$error = $operationResponse->getError();
7979
// handleError($error)

datastore/api/test/ConceptsTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,10 @@ public function testKeyFilter()
441441
$this->assertStringContainsString('Query\Query Object', $output);
442442

443443
$this->runEventuallyConsistentTest(
444-
function () use ($key1, $output) {
445-
$this->assertStringContainsString('Found 1 records', $output);
446-
$this->assertStringContainsString($key1->path()[0]['name'], $output);
447-
});
444+
function () use ($key1, $output) {
445+
$this->assertStringContainsString('Found 1 records', $output);
446+
$this->assertStringContainsString($key1->path()[0]['name'], $output);
447+
});
448448
}
449449

450450
public function testAscendingSort()

dlp/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ See the [DLP Documentation](https://cloud.google.com/dlp/docs/inspecting-text) f
5454
export GOOGLE_PROJECT_ID=YOUR_PROJECT_ID
5555
```
5656
- [Create a Google Cloud Storage bucket](https://console.cloud.google.com/storage) and upload [test.txt](src/test/data/test.txt).
57-
- Set the `GOOGLE_STORAGE_BUCKET` environment variable.
57+
- Set the `GOOGLE_STORAGE_BUCKET` environment variable.
5858
- Set the `GCS_PATH` environment variable to point to the path for the bucket file.
5959
```
6060
export GOOGLE_STORAGE_BUCKET=YOUR_BUCKET
@@ -120,7 +120,7 @@ PHP Fatal error: Uncaught Error: Call to undefined function Google\Protobuf\Int
120120
You may need to install the bcmath PHP extension.
121121
e.g. (may depend on your php version)
122122
```
123-
$ sudo apt-get install php8.0-bcmath
123+
$ sudo apt-get install php8.1-bcmath
124124
```
125125
126126

eventarc/generic/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# You may obtain a copy of the License at
66
#
77
# https://www.apache.org/licenses/LICENSE-2.0
8-
#
8+
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
1616

1717
# Use the official PHP image.
1818
# https://hub.docker.com/_/php
19-
FROM php:8.0-apache
19+
FROM php:8.1-apache
2020

2121
# Configure PHP for Cloud Run.
2222
# Precompile PHP code with opcache.

functions/helloworld_http/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"php": ">= 7.4",
3+
"php": ">= 8.1",
44
"google/cloud-functions-framework": "^1.1"
55
},
66
"scripts": {

functions/helloworld_pubsub/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"php": ">= 7.4",
3+
"php": ">= 8.1",
44
"cloudevents/sdk-php": "^1.0",
55
"google/cloud-functions-framework": "^1.1"
66
},

functions/helloworld_storage/SampleIntegrationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static function startFunctionFramework(): void
108108
$uri = 'localhost:' . $port;
109109

110110
// https://symfony.com/doc/current/components/process.html#usage
111-
self::$process = new Process([$php, '-S', $uri, 'vendor/bin/router.php'], null, [
111+
self::$process = new Process([$php, '-S', $uri, 'vendor/google/cloud-functions-framework/router.php'], null, [
112112
'FUNCTION_SIGNATURE_TYPE' => 'cloudevent',
113113
'FUNCTION_TARGET' => 'helloGCS',
114114
]);

functions/helloworld_storage/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"php": ">= 7.4",
3+
"php": ">= 8.1",
44
"google/cloud-functions-framework": "^1.1"
55
},
66
"scripts": {

functions/http_content_type/index.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,30 @@ function helloContent(ServerRequestInterface $request): string
2626
switch ($request->getHeaderLine('content-type')) {
2727
// '{"name":"John"}'
2828
case 'application/json':
29-
if (!empty($body)) {
30-
$json = json_decode($body, true);
31-
if (json_last_error() != JSON_ERROR_NONE) {
32-
throw new RuntimeException(sprintf(
33-
'Could not parse body: %s',
34-
json_last_error_msg()
35-
));
36-
}
37-
$name = $json['name'] ?? $name;
38-
}
39-
break;
40-
// 'John', stored in a stream
29+
if (!empty($body)) {
30+
$json = json_decode($body, true);
31+
if (json_last_error() != JSON_ERROR_NONE) {
32+
throw new RuntimeException(sprintf(
33+
'Could not parse body: %s',
34+
json_last_error_msg()
35+
));
36+
}
37+
$name = $json['name'] ?? $name;
38+
}
39+
break;
40+
// 'John', stored in a stream
4141
case 'application/octet-stream':
42-
$name = $body;
43-
break;
44-
// 'John'
42+
$name = $body;
43+
break;
44+
// 'John'
4545
case 'text/plain':
46-
$name = $body;
47-
break;
48-
// 'name=John' in the body of a POST request (not the URL)
46+
$name = $body;
47+
break;
48+
// 'name=John' in the body of a POST request (not the URL)
4949
case 'application/x-www-form-urlencoded':
50-
parse_str($body, $data);
51-
$name = $data['name'] ?? $name;
52-
break;
50+
parse_str($body, $data);
51+
$name = $data['name'] ?? $name;
52+
break;
5353
}
5454

5555
return sprintf('Hello %s!', htmlspecialchars($name));

functions/response_streaming/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function streamBigQuery(ServerRequestInterface $request)
2727
$bigQuery = new BigQueryClient(['projectId' => $projectId]);
2828
$queryJobConfig = $bigQuery->query(
2929
'SELECT abstract FROM `bigquery-public-data.breathe.bioasq` LIMIT 1000'
30-
);
30+
);
3131
$queryResults = $bigQuery->runQuery($queryJobConfig);
3232

3333
// Stream out large payload by iterating rows and flushing output.

functions/typed_greeting/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"php": ">= 7.4",
3+
"php": ">= 8.1",
44
"google/cloud-functions-framework": "^1.3"
55
},
66
"scripts": {

run/helloworld/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# Use the official PHP image.
1919
# https://hub.docker.com/_/php
20-
FROM php:8.0-apache
20+
FROM php:8.1-apache
2121

2222
# Configure PHP for Cloud Run.
2323
# Precompile PHP code with opcache.

0 commit comments

Comments
 (0)