--- ./ext/posix/posix.c.orig	2022-12-04 23:56:57 +0000
+++ ./ext/posix/posix.c	2022-12-04 23:59:20 +0000
@@ -1157,6 +1157,19 @@
 		Z_PARAM_LONG(cur)
 		Z_PARAM_LONG(max)
 	ZEND_PARSE_PARAMETERS_END();
+	
+	#if defined(_AIX)
+        /*
+        On AIX, when cur > max setrlimit returns 0 and sets softlimit and hardlimit to max,
+        instead of returning -1, so we need to check the values to reproduce the same behavior
+        as setrlimit on Linux.
+        */
+        if (cur > max) {
+              POSIX_G(last_error) = EINVAL;
+              RETURN_FALSE;
+        }
+        #endif
+
 
 	rl.rlim_cur = cur;
 	rl.rlim_max = max;
