val,
  you dont clamp at the lower bound. suppose offset == -LONG_MAX

l0t3k
"val khokhlov" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 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:[EMAIL PROTECTED] 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to