Merge pull request #24796 from stanley-cheung/php-backports

A few recent PHP fixes to be backported to v1.34.x branch
pull/24807/head
Stanley Cheung 4 years ago committed by GitHub
commit 54b7f961c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      composer.json
  2. 2
      package.xml
  3. 2
      src/php/bin/build_all_docker_images.sh
  4. 2
      src/php/bin/run_all_docker_images.sh
  5. 2
      src/php/composer.json
  6. 4
      src/php/docker/alpine/Dockerfile
  7. 4
      src/php/docker/centos7/Dockerfile
  8. 4
      src/php/docker/grpc-ext/Dockerfile
  9. 4
      src/php/docker/grpc-src/Dockerfile
  10. 4
      src/php/docker/i386/Dockerfile
  11. 4
      src/php/docker/php-future/Dockerfile
  12. 4
      src/php/docker/php-src/Dockerfile
  13. 4
      src/php/docker/php-zts/Dockerfile
  14. 40
      src/php/docker/php8/Dockerfile
  15. 2
      src/php/tests/generated_code/AbstractGeneratedCodeTest.php
  16. 4
      src/php/tests/generated_code/GeneratedCodeTest.php
  17. 4
      src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php
  18. 6
      src/php/tests/unit_tests/CallCredentials2Test.php
  19. 6
      src/php/tests/unit_tests/CallCredentialsTest.php
  20. 6
      src/php/tests/unit_tests/CallInvokerTest.php
  21. 8
      src/php/tests/unit_tests/CallTest.php
  22. 6
      src/php/tests/unit_tests/ChannelCredentialsTest.php
  23. 6
      src/php/tests/unit_tests/ChannelTest.php
  24. 6
      src/php/tests/unit_tests/EndToEndTest.php
  25. 6
      src/php/tests/unit_tests/InterceptorTest.php
  26. 6
      src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php
  27. 6
      src/php/tests/unit_tests/SecureEndToEndTest.php
  28. 6
      src/php/tests/unit_tests/ServerTest.php
  29. 6
      src/php/tests/unit_tests/TimevalTest.php
  30. 2
      templates/composer.json.template
  31. 2
      templates/package.xml.template
  32. 2
      templates/src/php/composer.json.template
  33. 4
      templates/src/php/docker/download_phpunit.include
  34. 36
      templates/src/php/docker/php8/Dockerfile.template
  35. 4
      tools/dockerfile/distribtest/php7_stretch_x64/Dockerfile
  36. 4
      tools/gce/linux_kokoro_performance_worker_init.sh

@ -6,7 +6,7 @@
"homepage": "https://grpc.io", "homepage": "https://grpc.io",
"license": "Apache-2.0", "license": "Apache-2.0",
"require": { "require": {
"php": ">=5.5.0" "php": ">=7.0.0"
}, },
"require-dev": { "require-dev": {
"google/auth": "^v1.3.0" "google/auth": "^v1.3.0"

@ -1996,7 +1996,7 @@
<dependencies> <dependencies>
<required> <required>
<php> <php>
<min>5.5.0</min> <min>7.0.0</min>
</php> </php>
<pearinstaller> <pearinstaller>
<min>1.4.0</min> <min>1.4.0</min>

@ -17,7 +17,7 @@ set -e
cd $(dirname $0)/../../.. cd $(dirname $0)/../../..
ALL_IMAGES=( grpc-ext grpc-src alpine centos7 php-src php-future php-zts ALL_IMAGES=( grpc-ext grpc-src alpine centos7 php-src php-future php-zts
fork-support i386 ) fork-support i386 php8 )
if [[ "$1" == "--cmds" ]]; then if [[ "$1" == "--cmds" ]]; then
for arg in "${ALL_IMAGES[@]}" for arg in "${ALL_IMAGES[@]}"

@ -17,7 +17,7 @@ set -e
cd $(dirname $0)/../../.. cd $(dirname $0)/../../..
ALL_IMAGES=( grpc-ext grpc-src alpine centos7 php-src php-future php-zts ALL_IMAGES=( grpc-ext grpc-src alpine centos7 php-src php-future php-zts
fork-support i386 ) fork-support i386 php8 )
if [[ "$1" == "--cmds" ]]; then if [[ "$1" == "--cmds" ]]; then
for arg in "${ALL_IMAGES[@]}" for arg in "${ALL_IMAGES[@]}"

@ -4,7 +4,7 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"version": "1.34.0", "version": "1.34.0",
"require": { "require": {
"php": ">=5.5.0", "php": ">=7.0.0",
"google/protobuf": "^v3.3.0" "google/protobuf": "^v3.3.0"
}, },
"require-dev": { "require-dev": {

@ -21,8 +21,8 @@ ARG MAKEFLAGS=-j8
WORKDIR /tmp WORKDIR /tmp
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -35,8 +35,8 @@ ARG MAKEFLAGS=-j8
WORKDIR /tmp WORKDIR /tmp
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -23,8 +23,8 @@ ARG MAKEFLAGS=-j8
WORKDIR /tmp WORKDIR /tmp
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -23,8 +23,8 @@ ARG MAKEFLAGS=-j8
WORKDIR /tmp WORKDIR /tmp
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -23,8 +23,8 @@ ARG MAKEFLAGS=-j8
WORKDIR /tmp WORKDIR /tmp
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -23,8 +23,8 @@ ARG MAKEFLAGS=-j8
WORKDIR /tmp WORKDIR /tmp
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -23,8 +23,8 @@ RUN apt-get -qq update && apt-get -qq install -y \
WORKDIR /tmp WORKDIR /tmp
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -23,8 +23,8 @@ ARG MAKEFLAGS=-j8
WORKDIR /tmp WORKDIR /tmp
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -0,0 +1,40 @@
# Copyright 2020 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM php:8.0.0RC3-cli-buster
RUN apt-get -qq update && apt-get -qq install -y \
autoconf automake git libtool pkg-config \
valgrind wget zlib1g-dev
ARG MAKEFLAGS=-j8
WORKDIR /tmp
# install pear
RUN apt-get install expect -y && \
curl -LO http://pear.php.net/go-pear.phar && \
expect -c 'spawn php ./go-pear.phar; expect "or Enter to continue:"; send "\n"; expect "Currently used php.ini"; send "\n"; expect eof' && \
rm go-pear.phar
WORKDIR /github/grpc
COPY . .
RUN pear package && \
find . -name grpc-*.tgz | xargs -I{} pecl install {}
CMD php -d extension=grpc.so -r '$a = new \Grpc\Channel("dummy", []); echo get_class($a)."\n";'

@ -23,7 +23,7 @@ require_once realpath(dirname(__FILE__).'/../../vendor/autoload.php');
@include_once dirname(__FILE__).'/math.pb.php'; @include_once dirname(__FILE__).'/math.pb.php';
@include_once dirname(__FILE__).'/math_grpc_pb.php'; @include_once dirname(__FILE__).'/math_grpc_pb.php';
abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase abstract class AbstractGeneratedCodeTest extends \PHPUnit\Framework\TestCase
{ {
/** /**
* These tests require that a server exporting the math service must be * These tests require that a server exporting the math service must be

@ -20,7 +20,7 @@ require_once dirname(__FILE__).'/AbstractGeneratedCodeTest.php';
class GeneratedCodeTest extends AbstractGeneratedCodeTest class GeneratedCodeTest extends AbstractGeneratedCodeTest
{ {
public function setUp() public function setUp(): void
{ {
self::$client = new Math\MathClient( self::$client = new Math\MathClient(
getenv('GRPC_TEST_HOST'), [ getenv('GRPC_TEST_HOST'), [
@ -28,7 +28,7 @@ class GeneratedCodeTest extends AbstractGeneratedCodeTest
]); ]);
} }
public function tearDown() public function tearDown(): void
{ {
self::$client->close(); self::$client->close();
} }

@ -20,7 +20,7 @@ require_once dirname(__FILE__).'/AbstractGeneratedCodeTest.php';
class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest
{ {
public function setUp() public function setUp(): void
{ {
self::$client = new Math\MathClient( self::$client = new Math\MathClient(
getenv('GRPC_TEST_HOST'), getenv('GRPC_TEST_HOST'),
@ -35,7 +35,7 @@ class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest
]); ]);
} }
public function tearDown() public function tearDown(): void
{ {
self::$client->close(); self::$client->close();
} }

@ -17,9 +17,9 @@
* *
*/ */
class CallCredentials2Test extends PHPUnit_Framework_TestCase class CallCredentials2Test extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
$credentials = Grpc\ChannelCredentials::createSsl( $credentials = Grpc\ChannelCredentials::createSsl(
file_get_contents(dirname(__FILE__).'/../data/ca.pem')); file_get_contents(dirname(__FILE__).'/../data/ca.pem'));
@ -43,7 +43,7 @@ class CallCredentials2Test extends PHPUnit_Framework_TestCase
); );
} }
public function tearDown() public function tearDown(): void
{ {
unset($this->channel); unset($this->channel);
unset($this->server); unset($this->server);

@ -17,9 +17,9 @@
* *
*/ */
class CallCredentialsTest extends PHPUnit_Framework_TestCase class CallCredentialsTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
$this->credentials = Grpc\ChannelCredentials::createSsl( $this->credentials = Grpc\ChannelCredentials::createSsl(
file_get_contents(dirname(__FILE__).'/../data/ca.pem')); file_get_contents(dirname(__FILE__).'/../data/ca.pem'));
@ -49,7 +49,7 @@ class CallCredentialsTest extends PHPUnit_Framework_TestCase
); );
} }
public function tearDown() public function tearDown(): void
{ {
unset($this->channel); unset($this->channel);
unset($this->server); unset($this->server);

@ -159,16 +159,16 @@ class CallInvokerChangeRequestCall
} }
} }
class CallInvokerTest extends PHPUnit_Framework_TestCase class CallInvokerTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
$this->server = new Grpc\Server([]); $this->server = new Grpc\Server([]);
$this->port = $this->server->addHttp2Port('0.0.0.0:0'); $this->port = $this->server->addHttp2Port('0.0.0.0:0');
$this->server->start(); $this->server->start();
} }
public function tearDown() public function tearDown(): void
{ {
unset($this->server); unset($this->server);
} }

@ -16,19 +16,19 @@
* limitations under the License. * limitations under the License.
* *
*/ */
class CallTest extends PHPUnit_Framework_TestCase class CallTest extends \PHPUnit\Framework\TestCase
{ {
public static $server; public static $server;
public static $port; public static $port;
public static function setUpBeforeClass() public static function setUpBeforeClass(): void
{ {
self::$server = new Grpc\Server([]); self::$server = new Grpc\Server([]);
self::$port = self::$server->addHttp2Port('0.0.0.0:53000'); self::$port = self::$server->addHttp2Port('0.0.0.0:53000');
self::$server->start(); self::$server->start();
} }
public function setUp() public function setUp(): void
{ {
$this->channel = new Grpc\Channel('localhost:'.self::$port, [ $this->channel = new Grpc\Channel('localhost:'.self::$port, [
'force_new' => true, 'force_new' => true,
@ -38,7 +38,7 @@ class CallTest extends PHPUnit_Framework_TestCase
Grpc\Timeval::infFuture()); Grpc\Timeval::infFuture());
} }
public function tearDown() public function tearDown(): void
{ {
$this->channel->close(); $this->channel->close();
} }

@ -17,13 +17,13 @@
* *
*/ */
class ChanellCredentialsTest extends PHPUnit_Framework_TestCase class ChanellCredentialsTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
} }
public function tearDown() public function tearDown(): void
{ {
} }

@ -17,13 +17,13 @@
* *
*/ */
class ChannelTest extends PHPUnit_Framework_TestCase class ChannelTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
} }
public function tearDown() public function tearDown(): void
{ {
if (!empty($this->channel)) { if (!empty($this->channel)) {
$this->channel->close(); $this->channel->close();

@ -16,9 +16,9 @@
* limitations under the License. * limitations under the License.
* *
*/ */
class EndToEndTest extends PHPUnit_Framework_TestCase class EndToEndTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
$this->server = new Grpc\Server([]); $this->server = new Grpc\Server([]);
$this->port = $this->server->addHttp2Port('0.0.0.0:0'); $this->port = $this->server->addHttp2Port('0.0.0.0:0');
@ -28,7 +28,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase
$this->server->start(); $this->server->start();
} }
public function tearDown() public function tearDown(): void
{ {
$this->channel->close(); $this->channel->close();
unset($this->server); unset($this->server);

@ -215,9 +215,9 @@ class StopCallInterceptor extends Grpc\Interceptor
} }
} }
class InterceptorTest extends PHPUnit_Framework_TestCase class InterceptorTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
$this->server = new Grpc\Server([]); $this->server = new Grpc\Server([]);
$this->port = $this->server->addHttp2Port('0.0.0.0:0'); $this->port = $this->server->addHttp2Port('0.0.0.0:0');
@ -227,7 +227,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase
$this->server->start(); $this->server->start();
} }
public function tearDown() public function tearDown(): void
{ {
$this->channel->close(); $this->channel->close();
unset($this->server); unset($this->server);

@ -20,13 +20,13 @@
/** /**
* @group persistent_list_bound_tests * @group persistent_list_bound_tests
*/ */
class PersistentListTest extends PHPUnit_Framework_TestCase class PersistentListTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
} }
public function tearDown() public function tearDown(): void
{ {
$channel_clean_persistent = $channel_clean_persistent =
new Grpc\Channel('localhost:50010', []); new Grpc\Channel('localhost:50010', []);

@ -16,9 +16,9 @@
* limitations under the License. * limitations under the License.
* *
*/ */
class SecureEndToEndTest extends PHPUnit_Framework_TestCase class SecureEndToEndTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
$credentials = Grpc\ChannelCredentials::createSsl( $credentials = Grpc\ChannelCredentials::createSsl(
file_get_contents(dirname(__FILE__).'/../data/ca.pem')); file_get_contents(dirname(__FILE__).'/../data/ca.pem'));
@ -42,7 +42,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase
); );
} }
public function tearDown() public function tearDown(): void
{ {
$this->channel->close(); $this->channel->close();
unset($this->server); unset($this->server);

@ -17,14 +17,14 @@
* *
*/ */
class ServerTest extends PHPUnit_Framework_TestCase class ServerTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
$this->server = null; $this->server = null;
} }
public function tearDown() public function tearDown(): void
{ {
unset($this->server); unset($this->server);
} }

@ -16,13 +16,13 @@
* limitations under the License. * limitations under the License.
* *
*/ */
class TimevalTest extends PHPUnit_Framework_TestCase class TimevalTest extends \PHPUnit\Framework\TestCase
{ {
public function setUp() public function setUp(): void
{ {
} }
public function tearDown() public function tearDown(): void
{ {
unset($this->time); unset($this->time);
} }

@ -8,7 +8,7 @@
"homepage": "https://grpc.io", "homepage": "https://grpc.io",
"license": "Apache-2.0", "license": "Apache-2.0",
"require": { "require": {
"php": ">=5.5.0" "php": ">=7.0.0"
}, },
"require-dev": { "require-dev": {
"google/auth": "^v1.3.0" "google/auth": "^v1.3.0"

@ -52,7 +52,7 @@
<dependencies> <dependencies>
<required> <required>
<php> <php>
<min>5.5.0</min> <min>7.0.0</min>
</php> </php>
<pearinstaller> <pearinstaller>
<min>1.4.0</min> <min>1.4.0</min>

@ -6,7 +6,7 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"version": "${settings.php_version.php_composer()}", "version": "${settings.php_version.php_composer()}",
"require": { "require": {
"php": ">=5.5.0", "php": ">=7.0.0",
"google/protobuf": "^v3.3.0" "google/protobuf": "^v3.3.0"
}, },
"require-dev": { "require-dev": {

@ -1,3 +1,3 @@
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && ${'\\'} RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && ${'\\'}
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && ${'\\'} mv phpunit-8.5.8.phar /usr/local/bin/phpunit && ${'\\'}
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -0,0 +1,36 @@
%YAML 1.2
--- |
# Copyright 2020 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM php:8.0.0RC3-cli-buster
RUN apt-get -qq update && apt-get -qq install -y ${'\\'}
autoconf automake git libtool pkg-config ${'\\'}
valgrind wget zlib1g-dev
ARG MAKEFLAGS=-j8
WORKDIR /tmp
# install pear
RUN apt-get install expect -y && ${'\\'}
curl -LO http://pear.php.net/go-pear.phar && ${'\\'}
expect -c 'spawn php ./go-pear.phar; expect "or Enter to continue:"; send "\n"; expect "Currently used php.ini"; send "\n"; expect eof' && ${'\\'}
rm go-pear.phar
<%include file="../pecl_ext_build_src.include" />
CMD php -d extension=grpc.so -r '$a = new \Grpc\Channel("dummy", []); echo get_class($a)."\n";'

@ -16,6 +16,6 @@ FROM debian:stretch
RUN apt-get update && apt-get install -y php php-dev php-pear wget zlib1g-dev RUN apt-get update && apt-get install -y php php-dev php-pear wget zlib1g-dev
RUN wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ RUN wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit chmod +x /usr/local/bin/phpunit

@ -162,8 +162,8 @@ gem install bundler
# PHP dependencies # PHP dependencies
sudo apt-get install -y php7.2 php7.2-dev php-pear unzip zlib1g-dev sudo apt-get install -y php7.2 php7.2-dev php-pear unzip zlib1g-dev
sudo wget https://phar.phpunit.de/phpunit-5.7.27.phar && \ sudo wget https://phar.phpunit.de/phpunit-8.5.8.phar && \
sudo mv phpunit-5.7.27.phar /usr/local/bin/phpunit && \ sudo mv phpunit-8.5.8.phar /usr/local/bin/phpunit && \
sudo chmod +x /usr/local/bin/phpunit sudo chmod +x /usr/local/bin/phpunit
curl -sS https://getcomposer.org/installer | php curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer sudo mv composer.phar /usr/local/bin/composer

Loading…
Cancel
Save