diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat index 5762aa32414e4..43b1d7f93c82b 100644 --- a/.github/scripts/windows/test_task.bat +++ b/.github/scripts/windows/test_task.bat @@ -38,8 +38,7 @@ if %errorlevel% neq 0 exit /b 3 rem setup PostgreSQL related exts set PGUSER=postgres set PGPASSWORD=Password12! -rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12! -echo ^ >> "./ext/pgsql/tests/config.inc" +set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD% set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD% set TMP_POSTGRESQL_BIN=%PGBIN% "%TMP_POSTGRESQL_BIN%\createdb.exe" test @@ -141,7 +140,7 @@ copy /-y %DEPS_DIR%\bin\*.dll %PHP_BUILD_DIR%\* mkdir c:\tests_tmp -nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%" +nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL% ext\pgsql" set EXIT_CODE=%errorlevel% diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6b7f6afc446ae..f1ef6e92b14e8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -46,7 +46,7 @@ env: CXX: ccache g++ jobs: LINUX_X64: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' + if: false services: mysql: image: mysql:8.3 @@ -135,7 +135,7 @@ jobs: if: ${{ !matrix.asan }} uses: ./.github/actions/verify-generated-files LINUX_X32: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' + if: false name: LINUX_X32_DEBUG_ZTS runs-on: ubuntu-latest container: @@ -181,7 +181,7 @@ jobs: -d zend_extension=opcache.so -d opcache.enable_cli=1 MACOS_DEBUG_NTS: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' + if: false runs-on: macos-14 steps: - name: git checkout @@ -242,7 +242,7 @@ jobs: run: .github/scripts/windows/test.bat BENCHMARKING: name: BENCHMARKING - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' + if: false runs-on: ubuntu-22.04 steps: - name: git checkout @@ -338,7 +338,7 @@ jobs: $(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) \ > $GITHUB_STEP_SUMMARY FREEBSD: - if: github.repository == 'php/php-src' || github.event_name == 'pull_request' + if: false name: FREEBSD runs-on: ubuntu-latest timeout-minutes: 50 diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index e8fb99c7aca46..241dc214d8ebd 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1873,7 +1873,10 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_ zval dataset; ZVAL_COPY_VALUE(&dataset, return_value); - object_init_ex(return_value, ce); + zend_result obj_initialized = object_init_ex(return_value, ce); + if (UNEXPECTED(obj_initialized == FAILURE)) { + RETURN_THROWS(); + } if (!ce->default_properties_count && !ce->__set) { Z_OBJ_P(return_value)->properties = Z_ARR(dataset); } else { diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/config.inc index 66ba4810203af..1e48e8d10fa62 100644 --- a/ext/pgsql/tests/config.inc +++ b/ext/pgsql/tests/config.inc @@ -19,5 +19,3 @@ $view_def = "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name};"; $table_def = "CREATE TABLE {$table_name} (num int, str text, bin bytea);"; $table_def_92 = "CREATE TABLE {$table_name_92} (textary text[], jsn json);"; $field_name = "num"; // For pg_field_num() - -?> diff --git a/ext/pgsql/tests/lcmess.inc b/ext/pgsql/tests/lcmess.inc index 7c6e0b80ed7ba..a1bf61e6851c8 100644 --- a/ext/pgsql/tests/lcmess.inc +++ b/ext/pgsql/tests/lcmess.inc @@ -17,5 +17,3 @@ function _set_lc_messages($conn, $lc_messages = 'C') return true; } - -?> diff --git a/ext/pgsql/tests/pg_fetch_object_with_abstract_class.phpt b/ext/pgsql/tests/pg_fetch_object_with_abstract_class.phpt new file mode 100644 index 0000000000000..d04e66a043b87 --- /dev/null +++ b/ext/pgsql/tests/pg_fetch_object_with_abstract_class.phpt @@ -0,0 +1,59 @@ +--TEST-- +pg_fetch_object() with abstract class name +--EXTENSIONS-- +pgsql +--SKIPIF-- + +--FILE-- +getMessage(), PHP_EOL; +} + +try { + $result = pg_query($db, $sql); + var_dump(pg_fetch_object($result, NULL, 'C')); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} + +try { + $result = pg_query($db, $sql); + var_dump(pg_fetch_object($result, NULL, 'E')); +} catch(Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} + +?> +--CLEAN-- + +--EXPECT-- +Error: Cannot instantiate interface I +Error: Cannot instantiate abstract class C +Error: Cannot instantiate enum E diff --git a/ext/pgsql/tests/skipif.inc b/ext/pgsql/tests/skipif.inc index 06c3ff657115b..2ce5f46e7787b 100644 --- a/ext/pgsql/tests/skipif.inc +++ b/ext/pgsql/tests/skipif.inc @@ -1,4 +1,3 @@ - = 9.0\n"); } } - -?>