Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17468 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99056 invoked by uid 1010); 30 Jul 2005 12:32:03 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99041 invoked from network); 30 Jul 2005 12:32:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jul 2005 12:32:03 -0000 X-Host-Fingerprint: 66.156.0.138 adsl-156-0-138.asm.bellsouth.net Received: from ([66.156.0.138:25397] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 06/BB-04646-2437BE24 for ; Sat, 30 Jul 2005 08:32:03 -0400 Message-ID: <06.BB.04646.2437BE24@pb1.pair.com> To: internals@lists.php.net Reply-To: "cshmoove@bellsouth.net" References: <446750995.20050730134023@vk.kiev.ua> Date: Sat, 30 Jul 2005 08:21:06 -0700 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-Posted-By: 66.156.0.138 Subject: Re: [PHP-DEV] patch to allow negative string offsets in {} From: cshmoove@bellsouth.net val, you dont clamp at the lower bound. suppose offset == -LONG_MAX l0t3k "val khokhlov" wrote in message news:446750995.20050730134023@vk.kiev.ua... > Hello, > > a small patch that allows using negative value for offset in > $string{offset} > $string = "test"; > $string{-1} -> last 't' > $string{-2} -> 's' and so on... > > ================<< > --- zend_execute.c Mon Jul 18 11:20:19 2005 > +++ /home/val/src/php/php5.1/php-src/Zend/zend_execute.c Sat Jul 30 > 13:33:57 2005 > @@ -1097,6 +1097,7 @@ > result->str_offset.str = container; > PZVAL_LOCK(container); > result->str_offset.offset = > dim->value.lval; > + if (dim->value.lval < 0) > result->str_offset.offset += container->value.str.len; > result->var.ptr_ptr = NULL; > if (type == BP_VAR_R || type == > BP_VAR_IS) { > AI_USE_PTR(result->var); > > ================<< > > -- > Best regards, > val mailto:val@vk.kiev.ua