mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/pdo_pgsql: [RFC] Deprecate PGSQL_TRANSACTION_ constants. (#19594)
This commit is contained in:
@@ -499,6 +499,11 @@ PHP 8.5 UPGRADE NOTES
|
||||
PDO::sqliteCreateFunction() => Pdo\Sqlite::createFunction()
|
||||
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_driver_specific_pdo_constants_and_methods
|
||||
|
||||
- PDO_PGSQL: Constants related to transaction states have been deprecated:
|
||||
PDO::PGSQL_TRANSACTION_IDLE, PDO::PGSQL_TRANSACTION_ACTIVE, PDO::PGSQL_TRANSACTION_INTRANS,
|
||||
PDO::PGSQL_TRANSACTION_INERROR, PDO::PGSQL_TRANSACTION_UNKNOWN.
|
||||
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#extpdo_deprecations
|
||||
|
||||
- Reflection:
|
||||
. The setAccessible() methods of various Reflection objects have been
|
||||
deprecated, as those no longer have an effect.
|
||||
|
||||
@@ -19,18 +19,23 @@ class Pgsql extends \PDO
|
||||
#endif
|
||||
|
||||
/** @cvalue PGSQL_TRANSACTION_IDLE */
|
||||
#[\Deprecated(since: "8.5", message: "as it has no effect")]
|
||||
public const int TRANSACTION_IDLE = UNKNOWN;
|
||||
|
||||
/** @cvalue PGSQL_TRANSACTION_ACTIVE */
|
||||
#[\Deprecated(since: "8.5", message: "as it has no effect")]
|
||||
public const int TRANSACTION_ACTIVE = UNKNOWN;
|
||||
|
||||
/** @cvalue PGSQL_TRANSACTION_INTRANS */
|
||||
#[\Deprecated(since: "8.5", message: "as it has no effect")]
|
||||
public const int TRANSACTION_INTRANS = UNKNOWN;
|
||||
|
||||
/** @cvalue PGSQL_TRANSACTION_INERROR */
|
||||
#[\Deprecated(since: "8.5", message: "as it has no effect")]
|
||||
public const int TRANSACTION_INERROR = UNKNOWN;
|
||||
|
||||
/** @cvalue PGSQL_TRANSACTION_UNKNOWN */
|
||||
#[\Deprecated(since: "8.5", message: "as it has no effect")]
|
||||
public const int TRANSACTION_UNKNOWN = UNKNOWN;
|
||||
|
||||
public function escapeIdentifier(string $input): string {}
|
||||
|
||||
44
ext/pdo_pgsql/pdo_pgsql_arginfo.h
generated
44
ext/pdo_pgsql/pdo_pgsql_arginfo.h
generated
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 225cbb077d441f93b7c6bdb9826ab3e8f634b79d */
|
||||
* Stub hash: 0ea21010467d661416f0858f2bda095583ea3a36 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Pgsql_escapeIdentifier, 0, 1, IS_STRING, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
|
||||
@@ -105,32 +105,64 @@ static zend_class_entry *register_class_Pdo_Pgsql(zend_class_entry *class_entry_
|
||||
zval const_TRANSACTION_IDLE_value;
|
||||
ZVAL_LONG(&const_TRANSACTION_IDLE_value, PGSQL_TRANSACTION_IDLE);
|
||||
zend_string *const_TRANSACTION_IDLE_name = zend_string_init_interned("TRANSACTION_IDLE", sizeof("TRANSACTION_IDLE") - 1, 1);
|
||||
zend_declare_typed_class_constant(class_entry, const_TRANSACTION_IDLE_name, &const_TRANSACTION_IDLE_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_class_constant *const_TRANSACTION_IDLE = zend_declare_typed_class_constant(class_entry, const_TRANSACTION_IDLE_name, &const_TRANSACTION_IDLE_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(const_TRANSACTION_IDLE_name);
|
||||
|
||||
zval const_TRANSACTION_ACTIVE_value;
|
||||
ZVAL_LONG(&const_TRANSACTION_ACTIVE_value, PGSQL_TRANSACTION_ACTIVE);
|
||||
zend_string *const_TRANSACTION_ACTIVE_name = zend_string_init_interned("TRANSACTION_ACTIVE", sizeof("TRANSACTION_ACTIVE") - 1, 1);
|
||||
zend_declare_typed_class_constant(class_entry, const_TRANSACTION_ACTIVE_name, &const_TRANSACTION_ACTIVE_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_class_constant *const_TRANSACTION_ACTIVE = zend_declare_typed_class_constant(class_entry, const_TRANSACTION_ACTIVE_name, &const_TRANSACTION_ACTIVE_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(const_TRANSACTION_ACTIVE_name);
|
||||
|
||||
zval const_TRANSACTION_INTRANS_value;
|
||||
ZVAL_LONG(&const_TRANSACTION_INTRANS_value, PGSQL_TRANSACTION_INTRANS);
|
||||
zend_string *const_TRANSACTION_INTRANS_name = zend_string_init_interned("TRANSACTION_INTRANS", sizeof("TRANSACTION_INTRANS") - 1, 1);
|
||||
zend_declare_typed_class_constant(class_entry, const_TRANSACTION_INTRANS_name, &const_TRANSACTION_INTRANS_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_class_constant *const_TRANSACTION_INTRANS = zend_declare_typed_class_constant(class_entry, const_TRANSACTION_INTRANS_name, &const_TRANSACTION_INTRANS_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(const_TRANSACTION_INTRANS_name);
|
||||
|
||||
zval const_TRANSACTION_INERROR_value;
|
||||
ZVAL_LONG(&const_TRANSACTION_INERROR_value, PGSQL_TRANSACTION_INERROR);
|
||||
zend_string *const_TRANSACTION_INERROR_name = zend_string_init_interned("TRANSACTION_INERROR", sizeof("TRANSACTION_INERROR") - 1, 1);
|
||||
zend_declare_typed_class_constant(class_entry, const_TRANSACTION_INERROR_name, &const_TRANSACTION_INERROR_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_class_constant *const_TRANSACTION_INERROR = zend_declare_typed_class_constant(class_entry, const_TRANSACTION_INERROR_name, &const_TRANSACTION_INERROR_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(const_TRANSACTION_INERROR_name);
|
||||
|
||||
zval const_TRANSACTION_UNKNOWN_value;
|
||||
ZVAL_LONG(&const_TRANSACTION_UNKNOWN_value, PGSQL_TRANSACTION_UNKNOWN);
|
||||
zend_string *const_TRANSACTION_UNKNOWN_name = zend_string_init_interned("TRANSACTION_UNKNOWN", sizeof("TRANSACTION_UNKNOWN") - 1, 1);
|
||||
zend_declare_typed_class_constant(class_entry, const_TRANSACTION_UNKNOWN_name, &const_TRANSACTION_UNKNOWN_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_class_constant *const_TRANSACTION_UNKNOWN = zend_declare_typed_class_constant(class_entry, const_TRANSACTION_UNKNOWN_name, &const_TRANSACTION_UNKNOWN_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(const_TRANSACTION_UNKNOWN_name);
|
||||
|
||||
|
||||
zend_attribute *attribute_Deprecated_const_TRANSACTION_IDLE_0 = zend_add_class_constant_attribute(class_entry, const_TRANSACTION_IDLE, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2);
|
||||
ZVAL_STR(&attribute_Deprecated_const_TRANSACTION_IDLE_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5));
|
||||
attribute_Deprecated_const_TRANSACTION_IDLE_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE);
|
||||
zend_string *attribute_Deprecated_const_TRANSACTION_IDLE_0_arg1_str = zend_string_init("as it has no effect", strlen("as it has no effect"), 1);
|
||||
ZVAL_STR(&attribute_Deprecated_const_TRANSACTION_IDLE_0->args[1].value, attribute_Deprecated_const_TRANSACTION_IDLE_0_arg1_str);
|
||||
attribute_Deprecated_const_TRANSACTION_IDLE_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE);
|
||||
|
||||
zend_attribute *attribute_Deprecated_const_TRANSACTION_ACTIVE_0 = zend_add_class_constant_attribute(class_entry, const_TRANSACTION_ACTIVE, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2);
|
||||
ZVAL_STR(&attribute_Deprecated_const_TRANSACTION_ACTIVE_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5));
|
||||
attribute_Deprecated_const_TRANSACTION_ACTIVE_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE);
|
||||
ZVAL_STR_COPY(&attribute_Deprecated_const_TRANSACTION_ACTIVE_0->args[1].value, attribute_Deprecated_const_TRANSACTION_IDLE_0_arg1_str);
|
||||
attribute_Deprecated_const_TRANSACTION_ACTIVE_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE);
|
||||
|
||||
zend_attribute *attribute_Deprecated_const_TRANSACTION_INTRANS_0 = zend_add_class_constant_attribute(class_entry, const_TRANSACTION_INTRANS, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2);
|
||||
ZVAL_STR(&attribute_Deprecated_const_TRANSACTION_INTRANS_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5));
|
||||
attribute_Deprecated_const_TRANSACTION_INTRANS_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE);
|
||||
ZVAL_STR_COPY(&attribute_Deprecated_const_TRANSACTION_INTRANS_0->args[1].value, attribute_Deprecated_const_TRANSACTION_IDLE_0_arg1_str);
|
||||
attribute_Deprecated_const_TRANSACTION_INTRANS_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE);
|
||||
|
||||
zend_attribute *attribute_Deprecated_const_TRANSACTION_INERROR_0 = zend_add_class_constant_attribute(class_entry, const_TRANSACTION_INERROR, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2);
|
||||
ZVAL_STR(&attribute_Deprecated_const_TRANSACTION_INERROR_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5));
|
||||
attribute_Deprecated_const_TRANSACTION_INERROR_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE);
|
||||
ZVAL_STR_COPY(&attribute_Deprecated_const_TRANSACTION_INERROR_0->args[1].value, attribute_Deprecated_const_TRANSACTION_IDLE_0_arg1_str);
|
||||
attribute_Deprecated_const_TRANSACTION_INERROR_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE);
|
||||
|
||||
zend_attribute *attribute_Deprecated_const_TRANSACTION_UNKNOWN_0 = zend_add_class_constant_attribute(class_entry, const_TRANSACTION_UNKNOWN, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2);
|
||||
ZVAL_STR(&attribute_Deprecated_const_TRANSACTION_UNKNOWN_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5));
|
||||
attribute_Deprecated_const_TRANSACTION_UNKNOWN_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE);
|
||||
ZVAL_STR_COPY(&attribute_Deprecated_const_TRANSACTION_UNKNOWN_0->args[1].value, attribute_Deprecated_const_TRANSACTION_IDLE_0_arg1_str);
|
||||
attribute_Deprecated_const_TRANSACTION_UNKNOWN_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE);
|
||||
|
||||
return class_entry;
|
||||
}
|
||||
|
||||
31
ext/pdo_pgsql/tests/transations_deprecations.phpt
Normal file
31
ext/pdo_pgsql/tests/transations_deprecations.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test PDO::PGSQL_TRANSACTION* constants.
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip Not for Windows!');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(PDO::PGSQL_TRANSACTION_IDLE);
|
||||
var_dump(PDO::PGSQL_TRANSACTION_ACTIVE);
|
||||
var_dump(PDO::PGSQL_TRANSACTION_INTRANS);
|
||||
var_dump(PDO::PGSQL_TRANSACTION_INERROR);
|
||||
var_dump(PDO::PGSQL_TRANSACTION_UNKNOWN);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Constant PDO::PGSQL_TRANSACTION_IDLE is deprecated since 8.5 in %s on line %d
|
||||
int(0)
|
||||
|
||||
Deprecated: Constant PDO::PGSQL_TRANSACTION_ACTIVE is deprecated since 8.5 in %s on line %d
|
||||
int(1)
|
||||
|
||||
Deprecated: Constant PDO::PGSQL_TRANSACTION_INTRANS is deprecated since 8.5 in %s on line %d
|
||||
int(2)
|
||||
|
||||
Deprecated: Constant PDO::PGSQL_TRANSACTION_INERROR is deprecated since 8.5 in %s on line %d
|
||||
int(3)
|
||||
|
||||
Deprecated: Constant PDO::PGSQL_TRANSACTION_UNKNOWN is deprecated since 8.5 in %s on line %d
|
||||
int(4)
|
||||
Reference in New Issue
Block a user