diff --git a/.github/actions/setup-x64/action.yml b/.github/actions/setup-x64/action.yml index bb014bfe9de1..91cf7ea51c35 100644 --- a/.github/actions/setup-x64/action.yml +++ b/.github/actions/setup-x64/action.yml @@ -7,17 +7,14 @@ runs: set -x sudo service mysql start - sudo service postgresql start sudo service slapd start mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test" # Ensure local_infile tests can run. mysql -uroot -proot -e "SET GLOBAL local_infile = true" - sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" - sudo -u postgres psql -c "CREATE DATABASE test;" docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;" sudo locale-gen de_DE - ./.github/scripts/setup-slapd.sh &>/dev/null + ./.github/scripts/setup-slapd.sh sudo cp ext/snmp/tests/snmpd.conf /etc/snmp sudo cp ext/snmp/tests/bigtest /etc/snmp diff --git a/.github/actions/test-linux/action.yml b/.github/actions/test-linux/action.yml index c505a45c9aa7..9b7d0d100608 100644 --- a/.github/actions/test-linux/action.yml +++ b/.github/actions/test-linux/action.yml @@ -28,6 +28,8 @@ runs: export PDO_OCI_TEST_USER="system" export PDO_OCI_TEST_PASS="pass" export PDO_OCI_TEST_DSN="oci:dbname=localhost/XEPDB1;charset=AL32UTF8" + export PGSQL_TEST_CONNSTR="host=postgres dbname=test port=5432 user=postgres password=postgres" + export PDO_PGSQL_TEST_DSN="host=postgres dbname=test port=5432 user=postgres password=postgres" export SKIP_IO_CAPTURE_TESTS=1 export TEST_PHP_JUNIT=junit.out.xml export STACK_LIMIT_DEFAULTS_CHECK=1 diff --git a/.github/scripts/setup-slapd.sh b/.github/scripts/setup-slapd.sh index b9cb1a4ff7a9..c698d16afae9 100755 --- a/.github/scripts/setup-slapd.sh +++ b/.github/scripts/setup-slapd.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -ex +set -e # Create TLS certificate sudo mkdir -p /etc/ldap/ssl @@ -42,8 +42,6 @@ sudo sed -e 's|^\s*SLAPD_SERVICES\s*=.*$|SLAPD_SERVICES="ldap:/// ldaps:/// ldap # Configure LDAP database. DBDN=`sudo ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config '(&(olcRootDN=*)(olcSuffix=*))' dn | grep -i '^dn:' | sed -e 's/^dn:\s*//'`; -sudo ldapadd -Q -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/ppolicy.ldif - sudo service slapd restart sudo ldapmodify -Q -Y EXTERNAL -H ldapi:/// << EOF diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 621a70f3c9e1..216093d56f07 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -35,6 +35,13 @@ jobs: LINUX_X64: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test strategy: fail-fast: false matrix: @@ -47,7 +54,7 @@ jobs: zts: [true, false] include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.matrix-include) }} name: "${{ matrix.branch.name }}_LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: git checkout uses: actions/checkout@v3 @@ -122,7 +129,7 @@ jobs: name: "${{ matrix.branch.name }}_LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" runs-on: ubuntu-latest container: - image: ubuntu:20.04 + image: ubuntu:22.04 env: MYSQL_TEST_HOST: mysql PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test @@ -246,7 +253,14 @@ jobs: uses: ./.github/actions/verify-generated-files COVERAGE_DEBUG_NTS: if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-20.04 + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test + runs-on: ubuntu-22.04 steps: - name: git checkout uses: actions/checkout@v3 @@ -286,7 +300,7 @@ jobs: matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} name: "${{ matrix.branch.name }}_COMMUNITY" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: UBSAN_OPTIONS: print_stacktrace=1 USE_ZEND_ALLOC: 0 @@ -396,12 +410,19 @@ jobs: OPCACHE_VARIATION: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test strategy: fail-fast: false matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} name: "${{ matrix.branch.name }}_OPCACHE_VARIATION" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: git checkout uses: actions/checkout@v3 @@ -567,7 +588,7 @@ jobs: exclude: - branch: { name: 'PHP-80', ref: 'PHP-8.0' } name: "${{ matrix.branch.name }}_LIBMYSQLCLIENT" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: git checkout uses: actions/checkout@v3 @@ -614,7 +635,7 @@ jobs: uses: ./.github/actions/verify-generated-files PECL: if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: CC: ccache gcc CXX: ccache g++ diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 309205404daf..b0e586a6126b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -28,6 +28,13 @@ env: CXX: ccache g++ jobs: LINUX_X64: + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test strategy: fail-fast: false matrix: @@ -37,7 +44,7 @@ jobs: - debug: false zts: true name: "LINUX_X64_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: git checkout uses: actions/checkout@v3 @@ -85,7 +92,7 @@ jobs: name: LINUX_X32_DEBUG_ZTS runs-on: ubuntu-latest container: - image: ubuntu:20.04 + image: ubuntu:22.04 env: MYSQL_TEST_HOST: mysql PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 8f9b7fd4a9e3..48e648ce4ba6 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -737,4 +737,17 @@ extern "C++" { # define ZEND_INDIRECT_RETURN #endif +#if __GNUC__ && !defined(__clang__) +# define __DO_PRAGMA(x) _Pragma(#x) +# define _DO_PRAGMA(x) __DO_PRAGMA(x) +# define ZEND_CGG_DIAGNOSTIC_IGNORED_START(warning) \ + _Pragma("GCC diagnostic push") \ + _DO_PRAGMA(GCC diagnostic ignored warning) +# define ZEND_CGG_DIAGNOSTIC_IGNORED_END \ + _Pragma("GCC diagnostic pop") +#else +# define ZEND_CGG_DIAGNOSTIC_IGNORED_START(warning) +# define ZEND_CGG_DIAGNOSTIC_IGNORED_END +#endif + #endif /* ZEND_PORTABILITY_H */ diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index bdb535fd9369..96d91a11f654 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -525,11 +525,9 @@ PHP_RINIT_FUNCTION(imap) } /* }}} */ -/* {{{ PHP_RSHUTDOWN_FUNCTION */ -PHP_RSHUTDOWN_FUNCTION(imap) +static void free_errorlist(void) { ERRORLIST *ecur = NIL; - STRINGLIST *acur = NIL; if (IMAPG(imap_errorstack) != NIL) { /* output any remaining errors at their original error level */ @@ -545,6 +543,11 @@ PHP_RSHUTDOWN_FUNCTION(imap) mail_free_errorlist(&IMAPG(imap_errorstack)); IMAPG(imap_errorstack) = NIL; } +} + +static void free_stringlist(void) +{ + STRINGLIST *acur = NIL; if (IMAPG(imap_alertstack) != NIL) { /* output any remaining alerts at E_NOTICE level */ @@ -560,6 +563,13 @@ PHP_RSHUTDOWN_FUNCTION(imap) mail_free_stringlist(&IMAPG(imap_alertstack)); IMAPG(imap_alertstack) = NIL; } +} + +/* {{{ PHP_RSHUTDOWN_FUNCTION */ +PHP_RSHUTDOWN_FUNCTION(imap) +{ + free_errorlist(); + free_stringlist(); return SUCCESS; } /* }}} */ diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h index ce32d3cda8d9..1dcb41cfce7f 100644 --- a/ext/imap/php_imap.h +++ b/ext/imap/php_imap.h @@ -47,7 +47,9 @@ # endif /* these are used for quota support */ + ZEND_CGG_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes") # include "c-client.h" /* includes mail.h and rfc822.h */ + ZEND_CGG_DIAGNOSTIC_IGNORED_END # include "imap4r1.h" /* location of c-client quota functions */ #else # include "mail.h" diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index f063843bb01d..90a6331edb39 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -53,7 +53,9 @@ /* }}} */ #include "ext/standard/php_string.h" +ZEND_CGG_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes") #include +ZEND_CGG_DIAGNOSTIC_IGNORED_END #if !defined(OCI_MAJOR_VERSION) || OCI_MAJOR_VERSION < 11 || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION < 2)) #error This version of PHP OCI8 requires Oracle Client libraries from 11.2 or later. diff --git a/ext/pdo_oci/php_pdo_oci_int.h b/ext/pdo_oci/php_pdo_oci_int.h index dbffb22d092f..9f335fdcc844 100644 --- a/ext/pdo_oci/php_pdo_oci_int.h +++ b/ext/pdo_oci/php_pdo_oci_int.h @@ -14,7 +14,14 @@ +----------------------------------------------------------------------+ */ +#ifndef PHP_PDO_OCI_INT_H +#define PHP_PDO_OCI_INT_H + +#include "zend_portability.h" + +ZEND_CGG_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes") #include +ZEND_CGG_DIAGNOSTIC_IGNORED_END typedef struct { const char *file; @@ -105,3 +112,5 @@ enum { PDO_OCI_ATTR_MODULE, PDO_OCI_ATTR_CALL_TIMEOUT }; + +#endif /* PHP_PDO_OCI_INT_H */ diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index f42b1e2b9551..f48e1f94bb76 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -2386,7 +2386,14 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod if (style == SOAP_ENCODED) { if (soap_version == SOAP_1_1) { smart_str_0(&array_type); - if (strcmp(ZSTR_VAL(array_type.s),"xsd:anyType") == 0) { +#if defined(__GNUC__) && __GNUC__ >= 11 + ZEND_CGG_DIAGNOSTIC_IGNORED_START("-Wstringop-overread") +#endif + bool isXsdAnyType = strcmp(ZSTR_VAL(array_type.s),"xsd:anyType") == 0; +#if defined(__GNUC__) && __GNUC__ >= 11 + ZEND_CGG_DIAGNOSTIC_IGNORED_END +#endif + if (isXsdAnyType) { smart_str_free(&array_type); smart_str_appendl(&array_type,"xsd:ur-type",sizeof("xsd:ur-type")-1); }