mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
ext/gmp: Make GMP class final (#15121)
* ext/gmp: Make GMP class final RFC: https://wiki.php.net/rfc/gmp-final * Update UPGRADING Co-authored-by: Peter Kokot <peterkokot@gmail.com> --------- Co-authored-by: Peter Kokot <peterkokot@gmail.com>
This commit is contained in:
parent
9d7e6090df
commit
a50adda19e
3
NEWS
3
NEWS
@ -21,6 +21,9 @@ PHP NEWS
|
||||
. /dev/poll events.mechanism for Solaris/Illumos setting had been retired.
|
||||
(David Carlier)
|
||||
|
||||
- GMP:
|
||||
. The GMP class is now final and cannot be extended anymore.
|
||||
|
||||
- Intl:
|
||||
. Added SpoofChecker::setAllowedChars to set unicode chars ranges.
|
||||
(David Carlier)
|
||||
|
@ -48,6 +48,10 @@ PHP 8.4 UPGRADE NOTES
|
||||
object. This is no longer possible, and cloning a DOMXPath object now throws
|
||||
an error.
|
||||
|
||||
- GMP:
|
||||
. The GMP class is now final and cannot be extended anymore.
|
||||
RFC: https://wiki.php.net/rfc/gmp-final
|
||||
|
||||
- Intl:
|
||||
. resourcebundle_get(), ResourceBundle::get(), and accessing offsets on a
|
||||
ResourceBundle object now throw:
|
||||
|
@ -57,7 +57,7 @@ const GMP_BIG_ENDIAN = UNKNOWN;
|
||||
*/
|
||||
const GMP_NATIVE_ENDIAN = UNKNOWN;
|
||||
|
||||
class GMP
|
||||
final class GMP
|
||||
{
|
||||
public function __construct(int|string $num = 0, int $base = 0) {}
|
||||
|
||||
|
3
ext/gmp/gmp_arginfo.h
generated
3
ext/gmp/gmp_arginfo.h
generated
@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: d52f82c7084a8122fe07c91eb6d4ab6030daa27d */
|
||||
* Stub hash: 3aabd5a5d2db0df15b249a425465ae718c13ab6b */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_gmp_init, 0, 1, GMP, 0)
|
||||
ZEND_ARG_TYPE_MASK(0, num, MAY_BE_LONG|MAY_BE_STRING, NULL)
|
||||
@ -334,6 +334,7 @@ static zend_class_entry *register_class_GMP(void)
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "GMP", class_GMP_methods);
|
||||
class_entry = zend_register_internal_class_ex(&ce, NULL);
|
||||
class_entry->ce_flags |= ZEND_ACC_FINAL;
|
||||
|
||||
return class_entry;
|
||||
}
|
||||
|
12
ext/gmp/tests/final.phpt
Normal file
12
ext/gmp/tests/final.phpt
Normal file
@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Cannot extend GMP class
|
||||
--EXTENSIONS--
|
||||
gmp
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class T extends GMP {}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class T cannot extend final class GMP in %s on line %d
|
Loading…
Reference in New Issue
Block a user