** Description changed:

  [Impact]
  
-  * PHP7.4.3 has an issue with cURL where it is defaulting to chunked
+  * PHP7.4.3 has an issue with cURL where it is defaulting to chunked
  mode when transferring a file via POST. Setting the HTTP version does
  not impact it. For third-party servers that don't support chunked but
  expect a content-length, there is no way to make it work.
  
-  * See https://bugs.php.net/bug.php?id=79013 for this exact issue.
+  * See https://bugs.php.net/bug.php?id=79013 for this exact issue.
  
  [Test Case]
  
  * Here is a sample similar to what I'm doing, with url/token/file
  removed:
  
  -----------------
  
  <?php
  $url = '';
  $access_token = '';
  $file = '';
  $ch = curl_init($url);
  $options = [
-    CURLOPT_CUSTOMREQUEST => 'POST,
-    CURLOPT_RETURNTRANSFER => true,
-    CURLOPT_HTTPHEADER => [
-       'Authorization: Bearer ' . $access_token,
-       'Content-Type: multipart/form-data',
-    ],
-    CURLOPT_SSL_VERIFYHOST => 2,
-    CURLOPT_FOLLOWLOCATION => true,
-    CURLOPT_POSTREDIR => 3,
-    CURLINFO_HEADER_OUT => true,
-    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,//this has no effect
+    CURLOPT_CUSTOMREQUEST => 'POST,
+    CURLOPT_RETURNTRANSFER => true,
+    CURLOPT_HTTPHEADER => [
+       'Authorization: Bearer ' . $access_token,
+       'Content-Type: multipart/form-data',
+    ],
+    CURLOPT_SSL_VERIFYHOST => 2,
+    CURLOPT_FOLLOWLOCATION => true,
+    CURLOPT_POSTREDIR => 3,
+    CURLINFO_HEADER_OUT => true,
+    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,//this has no effect
  ];
  $file = curl_file_create(realpath($file), null, basename($file));
  $data = ['file' => $file, 'name' => basename($file)];
  $options[CURLOPT_POSTFIELDS] = $data;
  curl_setopt_array($ch, $options);
  $response = curl_exec($ch);
  $curl_info = curl_getinfo($ch);
  $curl_error = curl_error($ch);
  curl_close($ch);
  ?>
  
  -----------------
  
  This works in Ubuntu 18, but not Ubuntu 20.
  
  [Regression Potential]
  
-  * TBD
+ The fix itself for this bug is reasonably straightforward, but it builds
+ on an earlier patch that involved a fair bit of refactoring code.
+ 
+ This includes code which detects and adapts to libcurl > 7.56.0, so
+ behavioral regressions narrowable to the newer versions of libcurl could
+ potentially indicate a regression caused by this SRU.
+ 
  
  [Other Info]
-  
- Upgrading Ubuntu's supported PHP version to 7.4.4 *should* fix the issue, or 
backporting the patch in the link I included.
+ 
+ Upgrading Ubuntu's supported PHP version to 7.4.4 *should* fix the
+ issue, or backporting the patch in the link I included.
  
  package: php7.4 (7.4.3-4ubuntu2.2)(possibly related, libapache2-mod-php7.4d, 
php7.4-curl)
  release: Ubuntu 20.04 LTS
  
  Expect: PHP-cURL to POST HTTP1.1 multipart/form-data with automatically
  generated Content-Length and empty Transfer-Encoding headers.
  
  Actual: PHP-cURL POSTS HTTP1.1 multipart/form-data with Transfer-
  Encoding: chunked and empty Content-Length headers.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1887826

Title:
  CURLFile POST missing Content-Length header

To manage notifications about this bug go to:
https://bugs.launchpad.net/php/+bug/1887826/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to