| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,8 +36,7 @@ if %errorlevel% neq 0 exit /b 3 | |||
| 36 | 36 | rem setup PostgreSQL related exts | |
| 37 | 37 | set PGUSER=postgres | |
| 38 | 38 | set PGPASSWORD=Password12! | |
| 39 | - rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12! | ||
| 40 | - echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc" | ||
| 39 | + set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD% | ||
| 41 | 40 | set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD% | |
| 42 | 41 | set TMP_POSTGRESQL_BIN=%PGBIN% | |
| 43 | 42 | "%TMP_POSTGRESQL_BIN%\createdb.exe" test | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,6 +60,8 @@ PHP NEWS | |||
| 60 | 60 | ||
| 61 | 61 | - PgSql: | |
| 62 | 62 | . Fix memory leak when first string conversion fails. (nielsdos) | |
| 63 | + . Fix segfaults when attempting to fetch row into a non-instantiable class | ||
| 64 | + name. (Girgias, nielsdos) | ||
| 63 | 65 | ||
| 64 | 66 | - Phar: | |
| 65 | 67 | . Fix memory leak of argument in webPhar. (nielsdos) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2064,7 +2064,10 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_ | |||
| 2064 | 2064 | zval dataset; | |
| 2065 | 2065 | ||
| 2066 | 2066 | ZVAL_COPY_VALUE(&dataset, return_value); | |
| 2067 | - object_init_ex(return_value, ce); | ||
| 2067 | + zend_result obj_initialized = object_init_ex(return_value, ce); | ||
| 2068 | + if (UNEXPECTED(obj_initialized == FAILURE)) { | ||
| 2069 | + RETURN_THROWS(); | ||
| 2070 | + } | ||
| 2068 | 2071 | if (!ce->default_properties_count && !ce->__set) { | |
| 2069 | 2072 | Z_OBJ_P(return_value)->properties = Z_ARR(dataset); | |
| 2070 | 2073 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,4 +6,3 @@ | |||
| 6 | 6 | ||
| 7 | 7 | // "test" database must exist. i.e. "createdb test" before testing | |
| 8 | 8 | $conn_str = getenv('PGSQL_TEST_CONNSTR') ?: "host=localhost dbname=test port=5432 user=postgres password=postgres"; // connection string | |
| 9 | - ?> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,5 +17,3 @@ function _set_lc_messages($conn, $lc_messages = 'C') | |||
| 17 | 17 | ||
| 18 | 18 | return true; | |
| 19 | 19 | } | |
| 20 | - | ||
| 21 | - ?> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - | ||
| 2 | 1 | <?php | |
| 3 | 2 | // This script prints "skip" unless: | |
| 4 | 3 | // * the pgsql extension is built-in or loadable, AND | |
@@ -47,5 +46,3 @@ function skip_bytea_not_escape() | |||
| 47 | 46 | die("skip libpq or backend >= 9.0\n"); | |
| 48 | 47 | } | |
| 49 | 48 | } | |
| 50 | - | ||
| 51 | - ?> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,59 @@ | |||
| 1 | + --TEST-- | ||
| 2 | + pg_fetch_object() with abstract class name | ||
| 3 | + --EXTENSIONS-- | ||
| 4 | + pgsql | ||
| 5 | + --SKIPIF-- | ||
| 6 | + <?php | ||
| 7 | + include("skipif.inc"); | ||
| 8 | + ?> | ||
| 9 | + --FILE-- | ||
| 10 | + <?php | ||
| 11 | + | ||
| 12 | + interface I {} | ||
| 13 | + | ||
| 14 | + abstract class C {} | ||
| 15 | + | ||
| 16 | + enum E { | ||
| 17 | + case A; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + include "config.inc"; | ||
| 21 | + $table_name = "pg_fetch_object_abstract_class"; | ||
| 22 | + $db = pg_connect($conn_str); | ||
| 23 | + pg_query($db, "CREATE TABLE {$table_name} (a integer, b text)"); | ||
| 24 | + pg_query($db, "INSERT INTO {$table_name} VALUES(0, 'ABC')"); | ||
| 25 | + | ||
| 26 | + $sql = "SELECT * FROM $table_name WHERE a = 0"; | ||
| 27 | + | ||
| 28 | + try { | ||
| 29 | + $result = pg_query($db, $sql); | ||
| 30 | + var_dump(pg_fetch_object($result, NULL, 'I')); | ||
| 31 | + } catch(Throwable $e) { | ||
| 32 | + echo $e::class, ': ', $e->getMessage(), PHP_EOL; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + try { | ||
| 36 | + $result = pg_query($db, $sql); | ||
| 37 | + var_dump(pg_fetch_object($result, NULL, 'C')); | ||
| 38 | + } catch(Throwable $e) { | ||
| 39 | + echo $e::class, ': ', $e->getMessage(), PHP_EOL; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + try { | ||
| 43 | + $result = pg_query($db, $sql); | ||
| 44 | + var_dump(pg_fetch_object($result, NULL, 'E')); | ||
| 45 | + } catch(Throwable $e) { | ||
| 46 | + echo $e::class, ': ', $e->getMessage(), PHP_EOL; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + ?> | ||
| 50 | + --CLEAN-- | ||
| 51 | + <?php | ||
| 52 | + include('config.inc'); | ||
| 53 | + $db = @pg_connect($conn_str); | ||
| 54 | + @pg_query($db, "DROP TABLE IF EXISTS pg_fetch_object_abstract_class cascade"); | ||
| 55 | + ?> | ||
| 56 | + --EXPECT-- | ||
| 57 | + Error: Cannot instantiate interface I | ||
| 58 | + Error: Cannot instantiate abstract class C | ||
| 59 | + Error: Cannot instantiate enum E | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments