On Thu, Feb 25, 2016 at 2:02 PM, Dmitry Stogov <dmi...@zend.com> wrote:
> > > On 02/25/2016 03:05 PM, Nikita Popov wrote: > > On Thu, Feb 25, 2016 at 8:08 AM, Dmitry Stogov <dmi...@zend.com> wrote: > >> >> >> >> ________________________________ >> From: Dmitry Stogov >> Sent: Wednesday, February 24, 2016 13:35 >> To: Hynek Bartoš; php-...@lists.php.net; php-general-h...@lists.php.net >> Subject: Re: unpack() >> >> >> Hi, >> >> >> I think the requested feature may be really useful. >> >> And the implementation is really simple >> <https://gist.github.com/dstogov/edbb1efcd1e9701e75ab> >> https://gist.github.com/dstogov/edbb1efcd1e9701e75ab >> >> I think, committing this into master doesn't require RFC and voting. >> >> Anyone objects? >> > > How should this interact with absolute position references? Your current > patch changes input and inputlen, so absolute offsets will be relative to > the "offset" parameter and not relative to the actual start of the string. > Is this supposed to be so? > > And on that note, isn't this already covered by prefixing the unpack with > @offset? (Not to say that an explicit offset argument wouldn't be more > elegant.) > > > I've just got to know about possible usage of "@" in unpack(), but it > seems doesn't work at all > > $ sapi/cli/php -r 'var_dump(unpack("@0l", "\x01\x00\x00\x00")); ' > array(0) { > } > > Do I use it properly? > Unpack separates specifiers by /. So something like @0/l should work. Nikita