From 5d3bfc5ec80a920dc669979c2ffd18022210bfa4 Mon Sep 17 00:00:00 2001 From: Oleksandr Lysyuk Date: Mon, 12 Jun 2023 13:52:41 +0300 Subject: [PATCH 1/3] Php 8.2 deprecation fixes --- ext/tests/basic_context.phpt | 2 +- ext/tests/inherit_context.phpt | 2 +- src/Trace/Propagator/BinaryFormatter.php | 2 +- src/Trace/SpanContext.php | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ext/tests/basic_context.phpt b/ext/tests/basic_context.phpt index 8f162aa26..832103e50 100644 --- a/ext/tests/basic_context.phpt +++ b/ext/tests/basic_context.phpt @@ -4,7 +4,7 @@ OpenCensus Trace: Basic Context Test spanId(), 16, "0", STR_PAD_LEFT); + $spanHex = str_pad($context->spanId() ?? "", 16, "0", STR_PAD_LEFT); $traceOptions = $context->enabled() ? self::OPTION_ENABLED : 0; return pack("CCH*CH*CC", 0, 0, $context->traceId(), 1, $spanHex, 2, $traceOptions); } diff --git a/src/Trace/SpanContext.php b/src/Trace/SpanContext.php index 3bd9b9b03..567408300 100644 --- a/src/Trace/SpanContext.php +++ b/src/Trace/SpanContext.php @@ -52,6 +52,11 @@ class SpanContext */ private $enabled; + /** + * @var bool Whether or not the context was detected from an incoming header. + */ + private $fromHeader; + /** * Creates a new SpanContext instance * From f8bdf7adb71113cea7669a026257adccf60c708d Mon Sep 17 00:00:00 2001 From: Oleksandr Lysyuk Date: Mon, 12 Jun 2023 13:55:36 +0300 Subject: [PATCH 2/3] Enable integration tests on circleci --- .circleci/config.yml | 105 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7a7f8ec2a..7d9ee6c5c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -127,6 +127,16 @@ jobs: docker: - image: circleci/php:8.0-zts-node + php82: + <<: *unit-config + docker: + - image: circleci/php:8.2-node + + php82-zts: + <<: *unit-config + docker: + - image: circleci/php:8.2-zts-node + # Integration tests running on PHP 7.4. When updating these, please also update `integration-8.0` further down. integration-7.4: docker: @@ -313,6 +323,101 @@ jobs: DB_PASSWORD: mysql DB_DATABASE: mysqldb +# Integration tests running on PHP 8.2. When updating these, please also update `integration-7.4` further down. + integration-8.2: + docker: + - image: circleci/php:8.2-node + - image: memcached + - image: mysql:5.7 + environment: + MYSQL_USER: mysql + MYSQL_PASSWORD: mysql + MYSQL_DATABASE: mysqldb + MYSQL_RANDOM_ROOT_PASSWORD: yes + - image: postgres:9.6 + environment: + POSTGRES_PASSWORD: pgsql + POSTGRES_USER: postgres + steps: + - checkout + - run: + name: Install build tools + command: | + sudo apt-get update -y + sudo apt-get install -y -q --no-install-recommends \ + build-essential \ + g++ \ + gcc \ + libc-dev \ + libpqxx-dev \ + make \ + autoconf \ + git \ + unzip + - run: + name: Install opencensus extension + command: | + cd ext + phpize + ./configure --enable-opencensus + sudo make install + sudo docker-php-ext-enable opencensus + - run: + name: Install memcached extension + command: | + sudo apt-get install -y -q --no-install-recommends \ + libmemcached11 libmemcached-dev zlib1g-dev zlib1g + sudo pecl install memcached <<<'' + sudo docker-php-ext-enable memcached + - run: + name: Install pdo_mysql extension + command: sudo docker-php-ext-install pdo_mysql + - run: + name: Install mysqli extension + command: sudo docker-php-ext-install mysqli + - run: + name: Install pgsql extension + command: sudo docker-php-ext-install pgsql + - run: + name: Install pcntl extension + command: sudo docker-php-ext-install pcntl + - run: + name: Curl test + command: tests/integration/curl/test.sh + - run: + name: Guzzle 5 test + command: tests/integration/guzzle5/test.sh + - run: + name: Guzzle 6 test + command: tests/integration/guzzle6/test.sh + - run: + name: Laravel test + command: tests/integration/laravel/test.sh + - run: + name: Memcached test + command: tests/integration/memcached/test.sh + - run: + name: Pgsql test + command: tests/integration/pgsql/test.sh +# Skipped due to a dependency incompatibility between "cache/adapter-common" and "psr/cache". +# TODO(mrmage): Re-enable this step once "cache/adapter-common" supports "psr/cache" v2.0/v3.0. +# - run: +# name: Symfony 4 test +# command: tests/integration/symfony4/test.sh +# environment: +# DATABASE_URL: mysql://mysql:mysql@127.0.0.1:3306/mysqldb +# Skipped because "wp-cli" is currently not compatible with PHP 8 (see https://github.com/wp-cli/wp-cli/issues/5452). +# TODO(mrmage): Re-enable this step once "wp-cli" supports PHP 8. +# - run: +# name: Wordpress test +# command: tests/integration/wordpress/test.sh + environment: + DB_HOST: 127.0.0.1 + DB_USERNAME: mysql + DB_PASSWORD: mysql + DB_DATABASE: mysqldb + + workflows: version: 2 units: From 0cfabb9a79c2c34e263a225089fea232540755d5 Mon Sep 17 00:00:00 2001 From: Oleksandr Lysyuk Date: Mon, 12 Jun 2023 13:59:11 +0300 Subject: [PATCH 3/3] Add phpspec/prophecy as a rquirement --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4e7012301..7a465b4dc 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,8 @@ "twig/twig": "~2.0 || ~1.35", "symfony/yaml": "~3.3", "guzzlehttp/guzzle": "~5.3", - "guzzlehttp/psr7": "~1.4" + "guzzlehttp/psr7": "~1.4", + "phpspec/prophecy": "^1.17" }, "conflict": { "ext-opencensus": "< 0.1.0"