Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85912 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12358 invoked from network); 23 Apr 2015 08:59:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Apr 2015 08:59:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:35542] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/78-35080-974B8355 for ; Thu, 23 Apr 2015 04:59:38 -0400 Received: by labbd9 with SMTP id bd9so7939817lab.2 for ; Thu, 23 Apr 2015 01:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=P3lwt0GGz0edbc/fIuresoRT5xkxJXKpUmAoaDjRWhw=; b=ba3GzOEBw/1LeR3WVcuBASRiOtUHeblSPOAh/kmywhfLRNsSfogEWRQ8+v+0f4a7HP 5RYbHkDZvXhJ0/2JCYYmAtnspzyOm/poh/++Ulypkq0To6i8A/U1JW8vZpoXY/r+PUKc 4h6ki2dqeow19tDlXKa8FSWtMfZ/ED2Avu79my6TxyEOn+iiBN0tQxOcStyVy9uLGWBp dqnitkGqmQjrvB0GPhk/V8Dh3YJRrJIHUXhIgDBZSSC5dHWhqX6JbZtTvi5yqnQ+W10D f2wczcM2qU6/Z6aCpslEm79FiRZ9LgmVx6BeFNMGCimpE16Nk5d6ijD8pPpVTfR3Kixv HiQQ== MIME-Version: 1.0 X-Received: by 10.112.13.233 with SMTP id k9mr1571838lbc.57.1429779573916; Thu, 23 Apr 2015 01:59:33 -0700 (PDT) Sender: mike.php.net@gmail.com Received: by 10.114.62.176 with HTTP; Thu, 23 Apr 2015 01:59:33 -0700 (PDT) Received: by 10.114.62.176 with HTTP; Thu, 23 Apr 2015 01:59:33 -0700 (PDT) In-Reply-To: References: <5532CE2E.1040607@gmail.com> Date: Thu, 23 Apr 2015 10:59:33 +0200 X-Google-Sender-Auth: sMfHVqNAxWZf-CAb3sdwYP956HY Message-ID: To: Alexander Moskalev Cc: PHP Internals , =?UTF-8?B?SmFrdWIgS3Viw63EjWVr?= , Stanislav Malyshev Content-Type: multipart/alternative; boundary=001a11c3ca3a9c493f0514607f84 Subject: Re: [PHP-DEV] PR 1217: Add support for upload files from buffer string in curl extenion From: mike@php.net (Michael Wallner) --001a11c3ca3a9c493f0514607f84 Content-Type: text/plain; charset=UTF-8 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 --001a11c3ca3a9c493f0514607f84--