Re: Re: cvs: php-src /ext/sybase_ct
| From: | Timm Friebe | Date: | Sun, 16 May 2004 16:16:59 +0000 |
| Subject: | Re: Re: cvs: php-src /ext/sybase_ct | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9878@lists.php.net to get a copy of this message | ||
On Sun, 2004-05-16 at 17:57, Timm Friebe wrote:
> On Sun, 2004-05-16 at 17:17, Ard Biesheuvel wrote:
[...]
> -- snip --
> Z_STRLEN(result->data[i][j]) = result->lengths[j]-1;
> Z_STRVAL(result->data[i][j]) = estrndup(result->tmp_buffer[j],
> result->lengths[j]);
> Z_TYPE(result->data[i][j]) = IS_STRING;
>
> /* Now I want to figure out whether this fits into a long,
> * and if it does, make it one, a double otherwise
> */
>
> -- snip --
>
> Possible ideas would be to use strtol and check for ERANGE (sample
> attached).
Or, replying to myself, simply use convert_scalar_to_number() from
Zend/zend_operators.c which (AFAIS) does pretty much the same. The
testcase I wrote for this (attached) is passed here.
Ard, do you use sybase_ct? If so, could you verify it works for you,
too?
- Timm
Attachment: [application/x-php] test_long.phpt
Attachment: [application/x-php] test_long.phpt