I took a long time to get around to this, but I finally applied the
fix. Just setting the flag didn't work, but it was really easy to fix
the problem: I just changed the line

'file' => '@' . $filetosend,

to read

'file' => new CurlFile($filetosend, 'image/svg'),

and that seems to work fine.

Thanks again for your help!

David

On Mon, 11 Mar 2019 at 06:20, David Richfield <davidrichfi...@gmail.com> wrote:
>
> Thank you!!!  I'll fix that this week and compete my migration.
>
> Travis Briggs <audiod...@gmail.com> schrieb am So., 10. März 2019, 23:43:
>>
>> Okay I figured it out.
>>
>> The problem line is this:
>> https://github.com/slashme/parliamentdiagram/blob/master/parlitest.php#L517
>>
>> It sets a filename with the "@" prefix, which in Perl 5.5 generates a 
>> warning but still allows you to "slurp" the file that way. So when the CURL 
>> parts of your script execute they see:
>>
>> 'file': '@https://someurl.com/whatever/path.svg'
>>
>> as
>>
>> 'file': <binary file contents>
>>
>> As this article mentions (https://wiki.php.net/rfc/curl-file-upload), this 
>> was turned off in PHP 5.6. But actually, it was put behind a flag so you can 
>> easily re-enable it if you choose.
>>
>> You should simply have to set:
>>
>> curl_setopt($curl_handle, CURLOPT_SAFE_UPLOAD, false);
>>
>> If that doesn't work, the linked article also shows you how to create a 
>> "Curl file" object that you can pass around to upload.
>>
>> Hope this helps,
>> -Travis
>>
>> On Sun, Mar 10, 2019 at 2:59 PM David Richfield <davidrichfi...@gmail.com> 
>> wrote:
>>>
>>> OK, that is quite a jump.
>>>
>>> The source file is here: 
>>> https://github.com/slashme/parliamentdiagram/blob/master/parlitest.php
>>>
>>> Thanks for your help!!
>>>
>>> Travis Briggs <audiod...@gmail.com> schrieb am So., 10. März 2019, 22:55:
>>>>
>>>> As you can see here: 
>>>> https://wikitech.wikimedia.org/wiki/News/Toolforge_Trusty_deprecation#Language_runtime_and_library_versions
>>>>
>>>> PHP went from version 5.5.9 to version 7.2 in the upgrade.
>>>>
>>>> That's all I've got. Can I see your source code?
>>>>
>>>> -Travis
>>>>
>>>> On Sun, Mar 10, 2019 at 2:04 PM David Richfield <davidrichfi...@gmail.com> 
>>>> wrote:
>>>>>
>>>>> Hi Travis,
>>>>>
>>>>> That part of the tool is written in PHP, a language I don't speak
>>>>> natively: I hacked it together from Brad Jorsch's oauth-hello-world (
>>>>> https://tools.wmflabs.org/oauth-hello-world/index.php?action=download
>>>>> )
>>>>>
>>>>> Thanks
>>>>>
>>>>> David
>>>>>
>>>>> On Sun, 10 Mar 2019 at 21:55, Travis Briggs <audiod...@gmail.com> wrote:
>>>>> >
>>>>> > Hi David,
>>>>> >
>>>>> > What language is your tool running in? There are definitely major 
>>>>> > differences in versions on Stretch v Trusty. A library you were using 
>>>>> > on Trusty may have been upgraded and is behaving differently.
>>>>> >
>>>>> > That's about all I can think of from what you provided.
>>>>> >
>>>>> > Hope this helps,
>>>>> > -Travis
>>>>> >
>>>>> > On Sun, Mar 10, 2019 at 11:15 AM David Richfield 
>>>>> > <davidrichfi...@gmail.com> wrote:
>>>>> >>
>>>>> >> Hi all,
>>>>> >>
>>>>> >> I moved my tool (parliamentdiagram) to Stretch today, and everything
>>>>> >> works, except direct upload to Wikimedia Commons. I get the following
>>>>> >> error:
>>>>> >>
>>>>> >> "Error: File upload parameter "file" is not a file upload; be sure to
>>>>> >> use "multipart/form-data" for your POST and include a filename in the
>>>>> >> "Content-Disposition" header."
>>>>> >>
>>>>> >> The request looks like this:
>>>>> >>
>>>>> >> action: upload
>>>>> >> uri: 
>>>>> >> /data/project/parliamentdiagram/public_html/svgfiles/2019-03-10-18-07-19-687399-18179320035893093241.svg
>>>>> >> filename: My_Parliament.svg
>>>>> >> pagecontent: == {{int:filedesc}} ==
>>>>> >> (and some more content that I'm snipping for brevity)
>>>>> >>
>>>>> >> This works fine on Trusty, but neither on Gridengine or Kubernetes.
>>>>> >> Where should I look for the cause?
>>>>> >>
>>>>> >> For now, I'm going to keep the tool running on Trusty so that my users
>>>>> >> still have this option.
>>>>> >>
>>>>> >> --
>>>>> >> David Richfield
>>>>> >> +49 176 72663368
>>>>> >>
>>>>> >> _______________________________________________
>>>>> >> Wikimedia Cloud Services mailing list
>>>>> >> Cloud@lists.wikimedia.org (formerly lab...@lists.wikimedia.org)
>>>>> >> https://lists.wikimedia.org/mailman/listinfo/cloud
>>>>> >
>>>>> > _______________________________________________
>>>>> > Wikimedia Cloud Services mailing list
>>>>> > Cloud@lists.wikimedia.org (formerly lab...@lists.wikimedia.org)
>>>>> > https://lists.wikimedia.org/mailman/listinfo/cloud
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> David Richfield
>>>>> +49 176 72663368
>>>>>
>>>>> _______________________________________________
>>>>> Wikimedia Cloud Services mailing list
>>>>> Cloud@lists.wikimedia.org (formerly lab...@lists.wikimedia.org)
>>>>> https://lists.wikimedia.org/mailman/listinfo/cloud
>>>>
>>>> _______________________________________________
>>>> Wikimedia Cloud Services mailing list
>>>> Cloud@lists.wikimedia.org (formerly lab...@lists.wikimedia.org)
>>>> https://lists.wikimedia.org/mailman/listinfo/cloud
>>>
>>> _______________________________________________
>>> Wikimedia Cloud Services mailing list
>>> Cloud@lists.wikimedia.org (formerly lab...@lists.wikimedia.org)
>>> https://lists.wikimedia.org/mailman/listinfo/cloud
>>
>> _______________________________________________
>> Wikimedia Cloud Services mailing list
>> Cloud@lists.wikimedia.org (formerly lab...@lists.wikimedia.org)
>> https://lists.wikimedia.org/mailman/listinfo/cloud



-- 
David Richfield
+49 176 72663368

_______________________________________________
Wikimedia Cloud Services mailing list
Cloud@lists.wikimedia.org (formerly lab...@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/cloud

Reply via email to