Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeigniter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
#php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
#php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
php-versions: ${{fromJson(needs.required_php_versions.outputs.php_versions_matrix)}}
runs-on: ${{ matrix.operating-system }}
steps:
Expand Down
5 changes: 4 additions & 1 deletion application/helpers/kalkun_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ function DNDcheck($mobileno)
curl_setopt($request, CURLOPT_POSTFIELDS, $postString);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($request);
curl_close ($request);
if ( ! is_php('8.0'))
{
curl_close ($request);
}

$httpcode = curl_getinfo($request, CURLINFO_HTTP_CODE);
if ($httpcode !== 200)
Comment on lines +34 to 40

@coderabbitai coderabbitai Bot Oct 28, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: curl_getinfo called after curl_close on PHP < 8.0.

Line 39 calls curl_getinfo($request, CURLINFO_HTTP_CODE) after the conditional curl_close() at line 36. On PHP versions prior to 8.0, the handle is closed before curl_getinfo() is invoked, which will cause the function to fail or return invalid data.

Apply this diff to fix the order:

 	$response = curl_exec($request);
+	$httpcode = curl_getinfo($request, CURLINFO_HTTP_CODE);
 	if ( ! is_php('8.0'))
 	{
 		curl_close ($request);
 	}
 
-	$httpcode = curl_getinfo($request, CURLINFO_HTTP_CODE);
 	if ($httpcode !== 200)
 	{

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In application/helpers/kalkun_helper.php around lines 34-40, curl_getinfo is
being called after curl_close for PHP < 8.0 which can fail; move the call to
$httpcode = curl_getinfo($request, CURLINFO_HTTP_CODE) to occur before the
conditional curl_close(...) block so the HTTP code is retrieved while the handle
is still valid, then perform curl_close($request) inside the existing
is_php('8.0') check.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one @tenzap

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@tenzap tenzap Nov 21, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I'm a bit dubious. This was already like that before and this pr for php 8.5 doesn't add a regression here. Is this really required? Btw is DND in India still working today as 15 years ago? It is likely I added that regression at sometime because DND doesn't work anymore iirc.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point :)

Yes DND has evolved, and there is much larger registry for DND. These would need to be updated for such use

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this for now and make the change suggested here appart later (through a pr to check in ci, and then merge if it passes).

Expand Down
2 changes: 1 addition & 1 deletion application/models/Phonebook_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function convert_phonenumber($param)
$this->load->model('Kalkun_model');
$country_code = $this->Kalkun_model->get_setting($param['id_user'])->row('country_code');
$phoneNumberUtil = \libphonenumber\PhoneNumberUtil::getInstance();
$dial_code = '+'.$phoneNumberUtil->getCountryCodeForRegion($country_code);
$dial_code = '+'.$phoneNumberUtil->getCountryCodeForRegion(strval($country_code));
$number_local = str_replace($dial_code, '0', $param['number']);
$number_inter = $dial_code.substr($param['number'], 1);
return array($param['number'], $number_local, $number_inter);
Comment on lines +507 to 510

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Good cast; add normalization and guard for invalid/empty region (prevents '+0').

Casting to string is correct for PHP 8.x. Add uppercasing and handle empty/unknown region to avoid producing '+0' and bad local/international variants.

Apply minimally defensive changes:

-        $dial_code = '+'.$phoneNumberUtil->getCountryCodeForRegion(strval($country_code));
+        $region = strtoupper((string) $country_code);
+        $cc = $phoneNumberUtil->getCountryCodeForRegion($region);
+        if ($cc === 0) {
+            log_message('warning', 'Unknown/empty country_code for user '.$param['id_user'].' in convert_phonenumber()');
+            // keep current behavior but avoid '+0'
+            return array($param['number'], $param['number'], $param['number']);
+        }
+        $dial_code = '+'.$cc;

Verify what is stored in settings to ensure we're passing an ISO 3166-1 alpha-2 region (e.g., 'ID'), not a calling code (e.g., '62'):


🏁 Script executed:

#!/bin/bash
# Inspect usages and likely values of `country_code` across the repo
rg -n -C3 '\bcountry_code\b' --hidden -g '!vendor/**'
rg -n -C3 'get_setting\s*\(.*\)\s*->row\(\s*([\'"])country_code\1\)' --hidden -g '!vendor/**'
# Check if code elsewhere treats it as a region vs calling code
rg -n -C3 'getCountryCodeForRegion\(' --hidden -g '!vendor/**'

Length of output: 22867


Add uppercasing and guard against invalid regions to prevent '+0' dial codes.

The cast to string is correct for PHP 8.x. However, region codes must be uppercase, and getCountryCodeForRegion() returns 0 for invalid regions, which would produce a "+0" dial code. Add normalization and validation:

-        $dial_code = '+'.$phoneNumberUtil->getCountryCodeForRegion(strval($country_code));
+        $region = strtoupper((string) $country_code);
+        $cc = $phoneNumberUtil->getCountryCodeForRegion($region);
+        if ($cc === 0) {
+            log_message('warning', 'Unknown/empty country_code for user '.$param['id_user'].' in convert_phonenumber()');
+            // keep current behavior but avoid '+0'
+            return array($param['number'], $param['number'], $param['number']);
+        }
+        $dial_code = '+'.$cc;
🤖 Prompt for AI Agents
In application/models/Phonebook_model.php around lines 507 to 510, the region
passed to getCountryCodeForRegion must be uppercased and its return value
validated because getCountryCodeForRegion returns 0 for invalid regions (which
would produce "+0"). Normalize the region with
strtoupper(strval($country_code)), call getCountryCodeForRegion on that, check
the result is non-zero before building $dial_code (and handle the invalid case —
e.g., skip replacement/formatting or return original number with a
logged/handled error), then proceed to compute $number_local and $number_inter
only when a valid dial code exists.

Expand Down
5 changes: 4 additions & 1 deletion application/models/gateway/Connekt_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ function really_send_messages($data)
$response = curl_exec($curl);
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

curl_close($curl);
if ( ! is_php('8.0'))
{
curl_close ($curl);
}

$is_succes = ($httpcode >= 200 && $httpcode < 300) ? TRUE : FALSE;
if ($is_succes)
Expand Down
5 changes: 4 additions & 1 deletion application/models/gateway/Tmobilecz_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ function sendTMobileCZ($uid, $pwd, $phone, $msg, $isFlash = FALSE, $dRpt = FALSE
};
log_message('debug', 'TMCZ> SMS sent successfully.');

curl_close($curl);
if ( ! is_php('8.0'))
{
curl_close ($curl);
}
Comment on lines +246 to +249

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify the necessity of skipping curl_close() on PHP 8.0+.

While the change follows the pattern established in application/plugins/sms_to_xmpp/libraries/abhinavsingh-JAXL-5829c3b/core/jaxl.util.php, it's unclear whether skipping curl_close() is actually necessary for PHP 8.0+ compatibility. In PHP 8.0+, curl handles became CurlHandle objects with automatic cleanup, but curl_close() should still be safe to call and is not deprecated.

Please search for documentation to confirm whether there are any issues with calling curl_close() explicitly in PHP 8.0+ that would justify skipping it:

Additionally, note that scripts/cURL/Kalkun_API.php line 60 still calls curl_close($ch) unconditionally. If skipping curl_close() on PHP 8.0+ is necessary, that file should also be updated for consistency.


🌐 Web query:

Does curl_close() cause issues or warnings in PHP 8.0 and later versions?

💡 Result:

Short answer: No serious issues in PHP 8.0–8.4, but it became a no‑op; starting with PHP 8.5 it is deprecated and will raise deprecation warnings.

Details:

  • In PHP 8.0 cURL handles were converted from resources to CurlHandle objects, so curl_close() no longer actually closes anything (handles are freed by object destruction/GC). Calling it is harmless in 8.0–8.4. [1][2]
  • The function was marked deprecated in the PHP 8.5 deprecations RFC/manual and will emit deprecation warnings in PHP 8.5+. Codebases have been updated to avoid calling these now no‑op functions. [1][3]

If you need compatibility: either unset the handle (unset($ch)) or stop calling curl_close() on PHP 8.5+ (guard the call by PHP version or by checking the handle type). [2][3]

Sources:
[1] PHP manual — curl_close.
[2] php.watch — CurlHandle / migration notes.
[3] PHP 8.5 deprecations / changelogs (no‑op function deprecations).


Update curl_close() guard to only skip on PHP 8.5+, not PHP 8.0+.

The current implementation is overly conservative. In PHP 8.0–8.4, curl_close() is harmless (it became a no-op when cURL handles became objects), but the code skips it for all PHP 8.0+ versions. The deprecation warning only applies to PHP 8.5+. Correct the condition to:

if ( ! is_php('8.5'))
{
    curl_close($curl);
}

Or alternatively, remove the guard entirely for PHP 8.0–8.4 compatibility and add it only when PHP 8.5+ support becomes critical. Additionally, scripts/cURL/Kalkun_API.php line 60 still calls curl_close() unconditionally—update it for consistency if this pattern is adopted.

🤖 Prompt for AI Agents
In application/models/gateway/Tmobilecz_model.php around lines 246 to 249, the
guard that skips curl_close() for PHP 8.0+ is too broad; change it so
curl_close() is skipped only for PHP 8.5+ (i.e., update the version check to
8.5) or remove the guard entirely and call curl_close() normally for PHP
8.0–8.4; also update scripts/cURL/Kalkun_API.php line 60 to apply the same
conditional guard (or remove its guard) so both places are consistent.

//$result[] = array('phone' => $p, 'msg' => urldecode($msg), 'result' => $res);
return $result;
}
Expand Down
5 changes: 4 additions & 1 deletion application/models/gateway/Way2sms_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ function sendWay2SMS($uid, $pwd, $phone, $msg)
curl_setopt($curl, CURLOPT_REFERER, $refurl);
$text = curl_exec($curl);

curl_close($curl);
if ( ! is_php('8.0'))
{
curl_close ($curl);
}
return $result;
}
}
5 changes: 4 additions & 1 deletion application/plugins/sms_to_twitter/libraries/Epi.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ private function storeResponse($done, $isAsynchronous = true)
}
if($isAsynchronous)
curl_multi_remove_handle($this->mc, $done['handle']);
curl_close($done['handle']);
if ( ! is_php('8.0'))
{
curl_close($done['handle']);
}
}

private function startTimer($key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ public static function curl($url, $type='GET', $headers=array(), $data=false, $u
$rs['errmsg'] = curl_error($ch);
$rs['header'] = curl_getinfo($ch);

curl_close($ch);
if ( ! is_php('8.0'))
{
curl_close($ch);
}
return $rs;
}

Expand Down Expand Up @@ -153,7 +156,7 @@ public static function implodeData($data) {

public static function generateNonce() {
$str = '';
my_mt_srand((double) microtime()*10000000);
my_mt_srand((float) microtime()*10000000);
for($i=0; $i<32; $i++)
$str .= chr(my_mt_rand(0, 255));
return $str;
Expand Down
3 changes: 2 additions & 1 deletion composer-test_deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"patches": {
"kenjis/ci-phpunit-test": {
"Add support for PHP 8.2": "patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.2.patch",
"Add support for PHP 8.4": "patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.4.patch"
"Add support for PHP 8.4": "patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.4.patch",
"Add support for PHP 8.5": "patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.5.patch"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion composer-test_deps.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "15cc53b73e1823153429070a7e9d2534",
"content-hash": "83e6b0f0260fc61da8f19d3d468cfb41",
"packages": [],
"packages-dev": [
{
Expand Down
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,7 @@
"Fix PHP8.4 deprecation": "patches/Datto_JsonRpcHttp/v5.0.6/0004-fix-deprecation-error-on-PHP-8.4.patch"
},
"econea/nusoap": {
"Fix PHP8.4 deprecation on xml_set_object()": "patches/Econea_Nusoap/v0.9.17/0001-fix-deprecation-warning-on-PHP-8.4-with-xml_set_obje.patch",
"Check if $_SERVER['SERVER_NAME'] is set": "patches/Econea_Nusoap/v0.9.17/0002-check-if-SERVER_NAME-is-set.patch",
"Revert & fix regression in 0.9.18": "patches/Econea_Nusoap/v0.9.18/0002-revert_fix_in_0.9.18.patch"
},
"kenjis/ci-phpunit-test": {
"Add support for PHP 8.2": "patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.2.patch",
"Add support for PHP 8.4": "patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.4.patch"
"Add support for PHP 8.5": "patches/Econea_Nusoap/v0.9.20/support_php-8.5.patch"
}
Comment thread
tenzap marked this conversation as resolved.
}
},
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions patches/Econea_Nusoap/v0.9.18/0002-revert_fix_in_0.9.18.patch

This file was deleted.

55 changes: 55 additions & 0 deletions patches/Econea_Nusoap/v0.9.20/support_php-8.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
RuntimeException: Non-canonical cast (double) is deprecated, use the (float) cast instead on line 7281 in file /home/runner/work/Kalkun/Kalkun/vendor/econea/nusoap/src/nusoap.php
RuntimeException: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead on line 7287 in file /home/runner/work/Kalkun/Kalkun/vendor/econea/nusoap/src/nusoap.php
RuntimeException: Function xml_parser_free() is deprecated since 8.5, as it has no effect since PHP 8.0 on line 6916 in file /home/runner/work/Kalkun/Kalkun/vendor/econea/nusoap/src/nusoap.php

--- a/src/nusoap.php
+++ b/src/nusoap.php
@@ -1263,7 +1263,7 @@
$this->setError($errstr);
}

- xml_parser_free($this->parser);
+ (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser);
unset($this->parser);
} else {
$this->debug('no xml passed to parseString()!!');
@@ -5010,12 +5010,12 @@
$this->debug($errstr);
$this->debug("XML payload:\n" . $wsdl_string);
$this->setError($errstr);
- xml_parser_free($this->parser);
+ (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser);
unset($this->parser);
return false;
}
// free the parser
- xml_parser_free($this->parser);
+ (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser);
unset($this->parser);
$this->debug('Parsing WSDL done');
// catch wsdl parse errors
@@ -6913,7 +6913,7 @@
}
}
}
- xml_parser_free($this->parser);
+ (PHP_VERSION_ID < 80000) && xml_parser_free($this->parser);
unset($this->parser);
} else {
$this->debug('xml was empty, didn\'t parse!');
@@ -7278,13 +7278,13 @@
return (int) $value;
}
if ($type == 'float' || $type == 'double' || $type == 'decimal') {
- return (double) $value;
+ return (float) $value;
}
if ($type == 'boolean') {
if (strtolower($value) == 'false' || strtolower($value) == 'f') {
return false;
}
- return (boolean) $value;
+ return (bool) $value;
}
if ($type == 'base64' || $type == 'base64Binary') {
$this->debug('Decode base64 value');
26 changes: 26 additions & 0 deletions patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
RuntimeException: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect on line 39 in file /home/runner/work/Kalkun/Kalkun/vendor/kenjis/ci-phpunit-test/application/tests/_ci_phpunit_test/CIPHPUnitTestReflection.php

--- a/application/tests/_ci_phpunit_test/CIPHPUnitTestReflection.php
+++ b/application/tests/_ci_phpunit_test/CIPHPUnitTestReflection.php
@@ -18,7 +18,9 @@
public static function getPrivateMethodInvoker($obj, $method)
{
$ref_method = new ReflectionMethod($obj, $method);
- $ref_method->setAccessible(true);
+ if ( ! is_php('8.1')) {
+ $ref_method->setAccessible(true);
+ }
$obj = (gettype($obj) === 'object') ? $obj : null;

return function () use ($obj, $ref_method) {
@@ -36,7 +38,9 @@
}

$ref_property = $ref_class->getProperty($property);
- $ref_property->setAccessible(true);
+ if ( ! is_php('8.1')) {
+ $ref_property->setAccessible(true);
+ }

return $ref_property;
}
Loading