Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85919 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36224 invoked from network); 23 Apr 2015 11:26:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Apr 2015 11:26:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=irker@irker.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=irker@irker.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain irker.net from 209.85.212.170 cause and error) X-PHP-List-Original-Sender: irker@irker.net X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:35970] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/6B-35080-1E6D8355 for ; Thu, 23 Apr 2015 07:26:25 -0400 Received: by wizk4 with SMTP id k4so212055592wiz.1 for ; Thu, 23 Apr 2015 04:26:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=lTxNwfDFEPXzGtxdUTg0EL9MqrRTis9maCRaS854CkE=; b=CcXMEEj7xjwCcD51rvrmoeTsbUvdZTYvRphZSP5zwqyqbbv7Fy67h8fIc01mTSQXnB xj+Ul8dmSJ4NHJEScOWpi/A3B0o6wEK8kbGR/qHxvOIxELoy/CPjo3RiBdIWuyd2RjSi RxGAhrLuEi4Kp/ysf+54IkUrt8lP6FQCtBBjL6OU4Vw2xuI9oWSpnOTdPxmQfZSqso4n igjSANLX4c5geej39jppGmnue1RLTwRkys6etX5AqReadS5UXT43NdVENUMN19qTq/OI Nyr5GjBd9v+8JzTag7HSOmCrlRTMTIbnIn9ZObXG44AI+jzLqlFMSRPsgebeXhl3NrLN Jpfw== X-Gm-Message-State: ALoCoQmP2jQyzegkFg043Z4isHx7ghAX8tvy0lz5Tu2SyBGECaIrSZDS8NfNUMLRoPdVBxMwD+YF X-Received: by 10.194.61.82 with SMTP id n18mr4284423wjr.35.1429788382556; Thu, 23 Apr 2015 04:26:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.56.4 with HTTP; Thu, 23 Apr 2015 04:26:01 -0700 (PDT) In-Reply-To: References: <5532CE2E.1040607@gmail.com> Date: Thu, 23 Apr 2015 14:26:01 +0300 Message-ID: To: Michael Wallner Cc: PHP Internals , =?UTF-8?B?SmFrdWIgS3Viw63EjWVr?= , Stanislav Malyshev Content-Type: multipart/alternative; boundary=047d7ba97780a591580514628cbd Subject: Re: [PHP-DEV] PR 1217: Add support for upload files from buffer string in curl extenion From: irker@irker.net (Alexander Moskalev) --047d7ba97780a591580514628cbd Content-Type: text/plain; charset=UTF-8 Because currently CURLFile have this constructor: public __construct ( string $filename [, string $mimetype [, string $postname ]] ) And we cannot replace this arguments to avoid BC break. 2015-04-23 11:59 GMT+03:00 Michael Wallner : > > On 22 Apr 2015 10:27, "Alexander Moskalev" wrote: > > > > Thanks to all for feedback! > > > > Let's try to integrate new feature to old class. > > We have constructor in CURLFile with one required parameter: $filename . > > To avoid BC break we cannot replace this parameter. So I suggest to do > it > > optional and add setBuffer() method. > > > > So we can create CURLFile with empty parameters in constructor and fill > it > > with setters. > > Have two more questions: > > 1) If we not fill all options or fille not compatible options, when we > must > > throw error? ? And what level of this error? (Sorry, I'm just php coder > and > > know about C language and php source so little) > > For file from disk(or other source) required $filename. For file from > > buffer required $buffer and $postname. > > 2) Curently CURLFile cannot be unserialized, because it contains > $filename > > (see source code). How it compatible with our dicussion? > > > > Why not a ctor as in: > > function __construct ($filename, $buffer = null) { > if (isset ($ buffer)) { > // use $ buffer > } else { > // use file contents > } > } > > The file name parameter can be of use anyway for posted file contents from > buffer. > > Cheers, > Mike > -- With regards, Alexander Moskalev irker@irker.net irker@php.net a.moskalev@corp.badoo.com --047d7ba97780a591580514628cbd--