Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71106 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37269 invoked from network); 12 Jan 2014 23:23:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2014 23:23:53 -0000 Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.48 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.128.48 mail-qe0-f48.google.com Received: from [209.85.128.48] ([209.85.128.48:53746] helo=mail-qe0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/64-13233-80423D25 for ; Sun, 12 Jan 2014 18:23:52 -0500 Received: by mail-qe0-f48.google.com with SMTP id k5so5285857qej.35 for ; Sun, 12 Jan 2014 15:23:49 -0800 (PST) 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=uxkSNsBp1fkZpIZPn522CwKuHOp3YnyDqVsWxItdrkg=; b=jR3SoKIP038mSAkc8G55x47E6aXdsNnsqPxIcWI8MXFqGpiogjGOFHYf7xdtTm6E1B uFKPFyGY40c/I8ndALcAcA8F41+9dcTHrf6VFV+7ZO4fRnt3Uw6JX8CnV4fHvWFf5gCS fHi6TEFl3kstcsLV+BtIUewk6k2rYGIjHlO7pINnQ9ed/rvW+z+oteF4/S7O59hxdG9B Hby6OEHAAuAG5dt49sJVYWXaaad4jDMKnTwbYQEZLKH0NhCVR/cEBvFpZznlZizi718a H6snhnqQ+6NcjMZQH42/fYyHJcbgoxS6q3MVrYgeMH3Y0rcbVwGbCvWYgkl+oLirhdkN f52A== MIME-Version: 1.0 X-Received: by 10.49.106.37 with SMTP id gr5mr33090752qeb.75.1389569029313; Sun, 12 Jan 2014 15:23:49 -0800 (PST) Sender: jakub.php@gmail.com Received: by 10.224.68.68 with HTTP; Sun, 12 Jan 2014 15:23:49 -0800 (PST) In-Reply-To: References: <10f19e40b03ee19837010a988eb05706.squirrel@webmail.klapt.com> <2e9df2840916d6e72255764a08086e57.squirrel@webmail.klapt.com> <09595ef77b25972feab8e047bebdd37c.squirrel@webmail.klapt.com> Date: Sun, 12 Jan 2014 23:23:49 +0000 X-Google-Sender-Auth: mdC25A4jhHAUWLnl9hQhZDOPL_U Message-ID: To: Anatol Belski Cc: Hannes Magnusson , Nikita Popov , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=047d7b6da24062193a04efce4009 Subject: Re: [PHP-DEV] [RFC] 64 bit platform improvements for string length and integer From: bukka@php.net (Jakub Zelenka) --047d7b6da24062193a04efce4009 Content-Type: text/plain; charset=ISO-8859-1 On Sun, Jan 12, 2014 at 9:18 PM, Jakub Zelenka wrote: > Hi Anatol, > > Jakub > On Sat, Jan 11, 2014 at 7:34 PM, Anatol Belski wrote: > >> If a library expects long, in the new code that's the issue on 32 bit >> windows only. So yes, probably the way you describe is plausible, check >> PHP_WIN32 and PHP_API_VERSION. Honestly, right at the place where I sit, I >> can't remember any library working with long (well, timeval struct and so >> on, not really libs). There are int, size_t, int64_t, ... so while the >> case you describe is of course possible, it's rather an exception. Usually >> a simple runtime range check will be good enough, if needed at all. >> >> > Actually there is one big library where you can find it. It's OpenSSL > which is why I was asking about it.. :) There are quite a few places where > it's used. The main ones are following: > > - ASN.1 API functions (I plan to completely wrap it :) ) where it's used > for data length. > - BIO_ctrl for length parameter (BIO_ctrl is a definition result for many > macros like BIO_set_mem_buf, BIO_set_buffer_size, BIO_set_write_buf_size...) > - Big numbers - there is a situation a bit more complicated but unsigned > long is used (there will be necessary some other checks anyway so it's not > an issue) > > I think that would be good to have a look to the other exts and double > check if used libs have long parameters for data lengths. If not, then I > agree with you that there is no point to do casting to long with warnings > just because of OpenSSL. > > However it would be good to define in compat header a macro for checking > that long != php_int_t . I know that it's currently only _WIN64 but if you > implement enabling 64bit on 32bit platform (future scope in the RFC :) ), > then there will be an extra definition. > > I was thinking a bit more what will be the consequences of asn1 and bio in my ext for "l" flag and it won't be such a big issue regarding to zpp. There are just few cases in asn1 (ASN1_INTEGER_set for example) and BIO stuff will probably require mainly string conversions which is a bit different issue... What's the actually plan for keeping BC for "s" and "p"? Is it gonna be zend_str_size from compat header and "s" and "p" aliases of "S" and "P"? Something like... ... char *s; zend_str_size len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &len) == FAILURE) { return; } ... If so, I think that that would be a slightly bigger issue (size_t vs int)... There are only two solutions of zpp "s" that I think of: 1. check range (INT_MAX) and cast it to int (possibly throw warning if it's out of range) -> that could result too many warning but it's safe 2. PHP version variable zend_str_size (see above) -> the same as discussed for long but considerably more places where we will need to find out what the zend_str_size really is. What do you think? Cheers Jakub --047d7b6da24062193a04efce4009--