[PECL-CVS] [pecl-math-stats] master: Merge pull request #15 from php/bug11

[email protected] (Rasmus Lerdorf via GitHub) Tue, 21 Apr 2026 02:43:27 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Rasmus Lerdorf (rlerdorf)
Committer: GitHub (web-flow)
Pusher: rlerdorf
Date: 2026-04-21T03:43:25+01:00

Commit: https://github.com/php/pecl-math-stats/commit/52b1b92d171046240c2db70f4c77a8f5f584f40d
Raw diff: https://github.com/php/pecl-math-stats/commit/52b1b92d171046240c2db70f4c77a8f5f584f40d.diff

Merge pull request #15 from php/bug11

Fixes #11

Changed paths:
  M  php_stats.c


Diff:

diff --git a/php_stats.c b/php_stats.c
index 7418dd8..5846efb 100644
--- a/php_stats.c
+++ b/php_stats.c
@@ -111,17 +111,19 @@ PHP_MINFO_FUNCTION(stats)
  *
  * This is not correct any more, depends on what compare_func is set to.
  */
+#if PHP_VERSION_ID >= 80000
+static int stats_array_data_compare(Bucket *f, Bucket *s)
+{
+#else
 static int stats_array_data_compare(const void *a, const void *b)
 {
-	Bucket *f;
-	Bucket *s;
+	Bucket *f = (Bucket *) a;
+	Bucket *s = (Bucket *) b;
+#endif
 	int result;
 	zval first;
 	zval second;
 
-	f = (Bucket *) a;
-	s = (Bucket *) b;
-
 	first = f->val;
 	second = s->val;