Skip to content

Commit a50adda

Browse files
Girgiaspetk
andauthored
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>
1 parent 9d7e609 commit a50adda

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ PHP NEWS
2121
. /dev/poll events.mechanism for Solaris/Illumos setting had been retired.
2222
(David Carlier)
2323

24+
- GMP:
25+
. The GMP class is now final and cannot be extended anymore.
26+
2427
- Intl:
2528
. Added SpoofChecker::setAllowedChars to set unicode chars ranges.
2629
(David Carlier)

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ PHP 8.4 UPGRADE NOTES
4848
object. This is no longer possible, and cloning a DOMXPath object now throws
4949
an error.
5050

51+
- GMP:
52+
. The GMP class is now final and cannot be extended anymore.
53+
RFC: https://wiki.php.net/rfc/gmp-final
54+
5155
- Intl:
5256
. resourcebundle_get(), ResourceBundle::get(), and accessing offsets on a
5357
ResourceBundle object now throw:

ext/gmp/gmp.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
*/
5858
const GMP_NATIVE_ENDIAN = UNKNOWN;
5959

60-
class GMP
60+
final class GMP
6161
{
6262
public function __construct(int|string $num = 0, int $base = 0) {}
6363

ext/gmp/gmp_arginfo.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/gmp/tests/final.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Cannot extend GMP class
3+
--EXTENSIONS--
4+
gmp
5+
--FILE--
6+
<?php
7+
8+
class T extends GMP {}
9+
10+
?>
11+
--EXPECTF--
12+
Fatal error: Class T cannot extend final class GMP in %s on line %d

0 commit comments

Comments
 (0)