From 28746891c85faffc0d0126fcf9ec202b6f244afa Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 16 Dec 2025 11:47:10 +0000 Subject: [PATCH] curl_close() is deprected and noop since PHP version 8.0 --- Zotlabs/Lib/Img_filesize.php | 11 +++++------ include/network.php | 5 ----- util/fpostit/fpostit.php | 27 +++++++++++++-------------- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/Zotlabs/Lib/Img_filesize.php b/Zotlabs/Lib/Img_filesize.php index 196697733..32dee82bb 100644 --- a/Zotlabs/Lib/Img_filesize.php +++ b/Zotlabs/Lib/Img_filesize.php @@ -25,18 +25,18 @@ class Img_filesize { static function getLocalFileSize($url) { - + $fname = basename($url); $resolution = 0; - + if(strpos($fname,'.') !== false) $fname = substr($fname,0,strpos($fname,'.')); - + if(substr($fname,-2,1) == '-') { $resolution = intval(substr($fname,-1,1)); $fname = substr($fname,0,-2); } - + $r = q("SELECT filesize FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", dbesc($fname), intval($resolution) @@ -116,7 +116,6 @@ function getRemoteFileSize($url) curl_exec($ch); curl_getinfo($ch); - curl_close($ch); return $size; -} \ No newline at end of file +} diff --git a/include/network.php b/include/network.php index 6ef0e9523..f244e09d3 100644 --- a/include/network.php +++ b/include/network.php @@ -187,7 +187,6 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { $newurl = $url . $newurl; $url_parsed = @parse_url($newurl); if (isset($url_parsed)) { - @curl_close($ch); return z_fetch_url($newurl,$binary,++$redirects,$opts); } } @@ -209,7 +208,6 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { $ret['debug'] = $curl_info; } - @curl_close($ch); return($ret); } @@ -352,7 +350,6 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) { // would somebody take lighttpd and just shoot it? if($http_code == 417) { - curl_close($ch); if($opts) { if($opts['headers']) $opts['headers'][] = 'Expect:'; @@ -377,7 +374,6 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) { $url_parsed = @parse_url($newurl); if (isset($url_parsed)) { - curl_close($ch); if($http_code == 303) { return z_fetch_url($newurl,false,++$redirects,$opts); } else { @@ -403,7 +399,6 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) { $ret['debug'] = $curl_info; } - curl_close($ch); return($ret); } diff --git a/util/fpostit/fpostit.php b/util/fpostit/fpostit.php index 491d81f6d..ab8843683 100755 --- a/util/fpostit/fpostit.php +++ b/util/fpostit/fpostit.php @@ -58,7 +58,7 @@ if ((isset($title)) && (isset($text)) && (isset($url))) { } if (isset($_POST['submit'])) { - + if (($_POST["friendika_acct_name"] != '') && ($_POST["friendika_password"] != '')) { $acctname = $_POST["friendika_acct_name"]; $tmp_account_array = explode("@", $acctname); @@ -71,31 +71,30 @@ if (isset($_POST['submit'])) { $url = "http://" . $hostname . '/api/statuses/update'; $data = array('status' => $content); - + // echo "posting to: $url
"; $c = curl_init(); - curl_setopt($c, CURLOPT_URL, $url); + curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_USERPWD, "$username:$password"); - curl_setopt($c, CURLOPT_POSTFIELDS, $data); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt($c, CURLOPT_POSTFIELDS, $data); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_FOLLOWLOCATION, true); - $c_result = curl_exec($c); - if(curl_errno($c)){ + $c_result = curl_exec($c); + if(curl_errno($c)){ $error = curl_error($c); showForm($error, $content); } - - curl_close($c); + if (!isset($error)) { echo ''; } - + } else { $error = "Missing account name and/or password...try again please"; showForm($error, $content); } - + } else { showForm(null, $content); } @@ -103,7 +102,7 @@ if (isset($_POST['submit'])) { function showForm($error, $content) { $username_cookie = $_COOKIE['username']; $password_cookie = $_COOKIE['password']; - + echo <<

@@ -121,9 +120,9 @@ function showForm($error, $content) {

EOF; - + } ?> - \ No newline at end of file +