Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/windows/test_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,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%

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion ext/pgsql/tests/config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ $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()

?>
?>
59 changes: 59 additions & 0 deletions ext/pgsql/tests/pg_fetch_object_with_abstract_class.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
--TEST--
pg_fetch_object() with abstract class name
--EXTENSIONS--
pgsql
--SKIPIF--
<?php
include("skipif.inc");
?>
--FILE--
<?php

interface I {}

abstract class C {}

enum E {
case A;
}

include "config.inc";
$table_name = "pg_fetch_object_abstract_class";
$db = pg_connect($conn_str);
pg_query($db, "CREATE TABLE {$table_name} (a integer, b text)");
pg_query($db, "INSERT INTO {$table_name} VALUES(0, 'ABC')");

$sql = "SELECT * FROM $table_name WHERE a = 0";

try {
$result = pg_query($db, $sql);
var_dump(pg_fetch_object($result, NULL, 'I'));
} catch(Throwable $e) {
echo $e::class, ': ', $e->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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe try without this last PHP_EOL wdyt ?

}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would it be possible to add the closing tag ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might also be the reason windows is confused

?>
--CLEAN--
<?php
include('config.inc');
$db = @pg_connect($conn_str);
@pg_query($db, "DROP TABLE IF EXISTS pg_fetch_object_abstract_class cascade");
?>
--EXPECT--
Error: Cannot instantiate interface I
Error: Cannot instantiate abstract class C
Error: Cannot instantiate enum E
7 changes: 5 additions & 2 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ function run_test(string $php, $file, array $env): string
@unlink($temp_skipif);
@unlink($test_skipif);
@unlink($tmp_post);
@unlink($temp_clean);
// @unlink($temp_clean);
@unlink($test_clean);
@unlink($preload_filename);

Expand Down Expand Up @@ -2534,11 +2534,12 @@ function run_test(string $php, $file, array $env): string
if (!$no_clean) {
$extra = !IS_WINDOWS ?
"unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
var_dump($test_clean);
$clean_output = system_with_timeout("$extra $orig_php $pass_options -q $orig_ini_settings $no_file_cache \"$test_clean\"", $env);
}

if (!$cfg['keep']['clean']) {
@unlink($test_clean);
// @unlink($test_clean);
}
}

Expand Down Expand Up @@ -2674,6 +2675,8 @@ function run_test(string $php, $file, array $env): string

if (!$leaked && !$failed_headers) {
// If the test passed and CLEAN produced output, report test as borked.
var_dump("clean output: ",bin2hex(string: $clean_output??''));
$clean_output = trim($clean_output ?? '');
if ($clean_output) {
show_result("BORK", $output, $tested_file, 'reason: invalid output from CLEAN', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = [
Expand Down