From 363b69338469244c55cfdcf7ac8ad393dcbfd66f Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 21 Mar 2023 15:17:25 -0700 Subject: [PATCH] support 7.2+ from pecl and add readme stuff about libcrypto issues --- .github/workflows/ci.yml | 5 ++--- README.md | 15 ++++++++++++--- crt/aws-crt-ffi | 2 +- dev-scripts/package.xml-template_post | 2 +- dev-scripts/run_tests.sh | 1 - ext/php_aws_crt.h | 1 + tests/SigningTest.php | 4 ---- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2030968..61326ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,11 +19,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup PHP with Xdebug - uses: shivammathur/setup-php@verbose + uses: shivammathur/setup-php@v2 with: coverage: xdebug php-version: 5.5 - extensions: crypto ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false - name: Checkout @@ -38,7 +37,7 @@ jobs: run: | phpize ./configure - make + USE_OPENSSL=OFF make ./dev-scripts/run_tests.sh php-linux-x64: diff --git a/README.md b/README.md index f8f3691..b04c979 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # AWS Common Runtime PHP bindings ## Requirements + * PHP 5.5+ on UNIX platforms, 7.2+ on Windows * CMake 3.x * GCC 4.4+, clang 3.8+ on UNIX, Visual Studio build tools on Windows @@ -17,7 +18,7 @@ pecl install awscrt composer require aws/aws-crt-php ``` -On Windows, you need to build from source as instruction written below for the native extension `php_awscrt.dll`. And, follow https://www.php.net/manual/en/install.pecl.windows.php#install.pecl.windows.loading to load extension. After that: +On Windows, you need to build from source as instruction written below for the native extension `php_awscrt.dll` . And, follow https://www.php.net/manual/en/install.pecl.windows.php#install.pecl.windows.loading to load extension. After that: ``` composer require aws/aws-crt-php @@ -46,7 +47,7 @@ $ ./dev-scripts/run_tests.sh From Command Prompt (not powershell). The instruction is based on Visual Studio 2019 on 64bit Windows. -``` bat +```bat > git clone --recursive https://github.com/awslabs/aws-crt-php.git > git clone https://github.com/microsoft/php-sdk-binary-tools.git C:\php-sdk > C:\php-sdk\phpsdk-vs16-x64.bat @@ -80,6 +81,7 @@ set CMAKE_GENERATOR_PLATFORM=x64 ``` ## Debugging + Using [PHPBrew](https://github.com/phpbrew/phpbrew) to build/manage multiple versions of PHP is helpful. Note: You must use a debug build of PHP to debug native extensions. @@ -96,13 +98,20 @@ $ ./configure $ make CMAKE_BUILD_TYPE=Debug ``` -Ensure that the php you launch from your debugger is the result of `which php`, not just +Ensure that the php you launch from your debugger is the result of `which php` , not just the system default php. ## Security See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. +## Knowning OpenSSL related issue (Unix only) + +* With php5.5 and openssl-3.0.2, signing functions will not work +* When your php loads a different version of openssl than your system openssl version, awscrt may fail to load. + +The easiest workaround to those issue is to build from source and get aws-lc as libscrypto for awscrt to depend on instead of your local openssl. Same instructions as [here](#building-from-github-source), but use `USE_OPENSSL=OFF make` instead of `make` + ## License This project is licensed under the Apache-2.0 License. diff --git a/crt/aws-crt-ffi b/crt/aws-crt-ffi index 3218acf..a76a837 160000 --- a/crt/aws-crt-ffi +++ b/crt/aws-crt-ffi @@ -1 +1 @@ -Subproject commit 3218acfdba488169b3ec8650f507f041882910ac +Subproject commit a76a837a8d30d18abc9a04b78c785e93f106d9c6 diff --git a/dev-scripts/package.xml-template_post b/dev-scripts/package.xml-template_post index 03b7b4a..fa275e6 100644 --- a/dev-scripts/package.xml-template_post +++ b/dev-scripts/package.xml-template_post @@ -2,7 +2,7 @@ - 5.5.0 + 7.2.0 1.10.0 diff --git a/dev-scripts/run_tests.sh b/dev-scripts/run_tests.sh index d3506a8..848840c 100755 --- a/dev-scripts/run_tests.sh +++ b/dev-scripts/run_tests.sh @@ -22,5 +22,4 @@ if [ ! -d vendor ]; then $PHP_BINARY -c php.ini $COMPOSER_BINARY update fi -$launcher $PHP_BINARY --version $launcher $PHP_BINARY -c php.ini vendor/bin/phpunit tests --debug diff --git a/ext/php_aws_crt.h b/ext/php_aws_crt.h index a1fd37c..dd42534 100644 --- a/ext/php_aws_crt.h +++ b/ext/php_aws_crt.h @@ -60,6 +60,7 @@ ZEND_EXTERN_MODULE_GLOBALS(awscrt) # define XRETURN_STRING(s) RETURN_STRING(s, 1) # define XRETVAL_STRINGL(s, l) RETVAL_STRINGL(s, l, 1) # define XRETVAL_STRING(s) RETVAL_STRING(s, 1) +/* zend_error_noreturn is not public until PHP7, but may still be visible with some PHP 5.X distributions */ # define zend_error_noreturn zend_error #endif /* PHP 5.x */ diff --git a/tests/SigningTest.php b/tests/SigningTest.php index 0a80675..77399ab 100644 --- a/tests/SigningTest.php +++ b/tests/SigningTest.php @@ -11,7 +11,6 @@ use AWS\CRT\Auth\Signing; use AWS\CRT\Auth\Signable; use AWS\CRT\Auth\StaticCredentialsProvider; use AWS\CRT\HTTP\Request; -use AWS\CRT\Log; require_once('common.inc'); @@ -66,9 +65,6 @@ final class SigningTest extends CrtTestCase { } public function testShouldSignHeader() { - Log::setLogLevel(Log::TRACE); - $stdout = fopen('php://stdout', 'w'); - Log::toStream($stdout); $credentials_provider = new StaticCredentialsProvider([ 'access_key_id' => self::SIGV4TEST_ACCESS_KEY_ID, 'secret_access_key' => self::SIGV4TEST_SECRET_ACCESS_KEY,