Re: [ZEND-ENGINE-CVS] cvs: Zend / zend_compile.c
| From: | Masaki Fujimoto | Date: | Fri, 16 Aug 2002 22:01:34 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: Zend / zend_compile.c | ||
| References: | 1 2 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-322@lists.php.net to get a copy of this message | ||
Sorry, but I cannot figure out your point, because all the changes of my
previous commit was in the zend_do_declare_stmt()...
You're mentioning some other things or I'm completely missing something ?
Masaki
On Fri, 16 Aug 2002 19:21:21 +0300
Andi Gutmans <andi@zend.com> wrote:
> You should handle the declare in zend_do_declare_stmt(). At that point the
> string is still alive.
>
> What are your needs?
>
> Andi
>
> At 07:29 AM 8/14/2002 +0900, Masaki Fujimoto wrote:
> >executing a following script causes this (when ZEND_MULTIBYTE is
> >defined):
> ><?php
> >declare(encoding=shift_jis);
> >?>
> >
> >gdb says:
> >[masaki-f@nx] gdb /home/masaki-f/cvs/php4/sapi/cli/php
> >(gdb) b zend_do_declare_stmt
> >Breakpoint 1 at 0x8162200: file
> >/home/masaki-f/cvs/php4/Zend/zend_compile.c, line 2217.
> >(gdb) r ~/sample.php
> >Starting program: /home/masaki-f/cvs/php4/sapi/cli/php ~/sample.php
> >
> >Breakpoint 1, zend_do_declare_stmt (var=0xbfffc910, val=0xbfffc930)
> > at /home/masaki-f/cvs/php4/Zend/zend_compile.c:2217
> >2217 convert_to_string(&var->u.constant);
> >(gdb) n
> >2219 if (!zend_binary_strcasecmp(var->u.constant.value.str.val,
> >var->u.constant.value.str.len, "ticks", sizeof("ticks")-1)) {
> >(gdb)
> >2227 convert_to_string(&val->u.constant);
> >(gdb) disp val->u.constant
> >1: val->u.constant = {value = {lval = 136542428, dval =
> >1.9165423041562003e-313, str = {
> > val = 0x82378dc "shift_jis", len = 9}, ht = 0x82378dc, obj = {ce =
> > 0x82378dc, properties = 0x9}},
> > type = 8 '\b', is_ref = 0 '\000', refcount = 1}
> >(gdb) n
> >2228 if (!val->u.constant.value.str.val) {
> >1: val->u.constant = {value = {lval = 0, dval = 1.9097962118687451e-313,
> >str = {val = 0x0, len = 9},
> > ht = 0x0, obj = {ce = 0x0, properties = 0x9}}, type = 3 '\003',
> > is_ref = 0 '\000', refcount = 1}
> >
> >convert_to_string seems to end up when the 'type' is unknown (== DEFAULT)...
> >anyway, I now think my patch did not have correct to way to fix the
> >problem, but currently I do not know what is the best way to fix this.
> >Would you please show me the way ?
> >
> >Masaki Fujimoto
> >
> >On Tue, 13 Aug 2002 19:25:23 +0300
> >Andi Gutmans <andi@zend.com> wrote:
> >
> > > This patch doesn't look very good. convert_to_string() shouldn't end up
> > > with a null in str.val. It could break lots of things and not only the
> > > place you just fixed now.
> > > When is this happening?
> > > Andi
> > >
> > > At 06:01 AM 8/13/2002 +0000, Masaki Fujimoto wrote:
> > > >fujimoto Tue Aug 13 02:01:40 2002 EDT
> > > >
> > > > Modified files:
> > > > /Zend zend_compile.c
> > > > Log:
> > > > fix segfaults
> > > >
> > > >
> > > >Index: Zend/zend_compile.c
> > > >diff -u Zend/zend_compile.c:1.234 Zend/zend_compile.c:1.235
> > > >--- Zend/zend_compile.c:1.234 Sun Aug 4 02:39:44 2002
> > > >+++ Zend/zend_compile.c Tue Aug 13 02:01:40 2002
> > > >@@ -2225,8 +2225,10 @@
> > > > zend_multibyte_filter old_input_filter;
> > > >
> > > > convert_to_string(&val->u.constant);
> > > >+ if (!val->u.constant.value.str.val) {
> > > >+ zend_error(E_COMPILE_ERROR, "Invalid encoding
> > > >specified (without quotes ?)");
> > > >+ }
> > > > new_encoding =
> > > > zend_multibyte_fetch_encoding(val->u.constant.value.str.val);
> > > >- efree(val->u.constant.value.str.val);
> > > > if (!new_encoding) {
> > > > zend_error(E_COMPILE_WARNING, "Unsupported
> > > > encoding [%s]\n", val->u.constant.value.str.val);
> > > > } else {
> > > >@@ -2240,6 +2242,7 @@
> > > > zend_yyinput_again(old_input_filter,
> > > > old_encoding TSRMLS_CC);
> > > > }
> > > > }
> > > >+ efree(val->u.constant.value.str.val);
> > > > #endif /* ZEND_MULTIBYTE */
> > > > }
> > > > zval_dtor(&var->u.constant);
> > > >
> > > >
> > > >
> > > >--
> > > >Zend Engine CVS Mailing List (http://cvs.php.net/)
> > > >To unsubscribe, visit:
> > > >http://www.php.net/unsub.php
>
>
> --
> Zend Engine CVS Mailing List (http://cvs.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php