Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #4819 > unrolled thread
| Started by | "aaa" <aaa@aaaaaaaaaaa.com> |
|---|---|
| First post | 2012-02-15 16:12 +0100 |
| Last post | 2012-02-15 20:00 +0100 |
| Articles | 8 — 6 participants |
Back to article view | Back to comp.lang.php
PHP 5.3.9 hex bug? "aaa" <aaa@aaaaaaaaaaa.com> - 2012-02-15 16:12 +0100
Re: PHP 5.3.9 hex bug? tony@mountifield.org (Tony Mountifield) - 2012-02-15 16:36 +0000
Re: PHP 5.3.9 hex bug? Denis McMahon <denismfmcmahon@gmail.com> - 2012-02-15 16:48 +0000
Re: PHP 5.3.9 hex bug? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-02-15 18:48 +0100
Re: PHP 5.3.9 hex bug? "aaa" <aaa@aaaaaaaaaaa.com> - 2012-02-16 10:38 +0100
Re: PHP 5.3.9 hex bug? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-02-16 14:08 +0100
Re: PHP 5.3.9 hex bug? Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2012-02-16 12:37 +0100
Re: PHP 5.3.9 hex bug? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-15 20:00 +0100
| From | "aaa" <aaa@aaaaaaaaaaa.com> |
|---|---|
| Date | 2012-02-15 16:12 +0100 |
| Subject | PHP 5.3.9 hex bug? |
| Message-ID | <jhgi0p$r76$1@speranza.aioe.org> |
Hello, Why is this: fseek($f, 0x0000+2, SEEK_SET); giving same result as: fseek($f, 4, SEEK_SET); and not same result as: fseek($f, 0000+2, SEEK_SET); or fseek($f, 2, SEEK_SET); ? What is wrong with the hex notation? -- A
[toc] | [next] | [standalone]
| From | tony@mountifield.org (Tony Mountifield) |
|---|---|
| Date | 2012-02-15 16:36 +0000 |
| Message-ID | <jhgmus$8av$1@softins.clara.co.uk> |
| In reply to | #4819 |
In article <jhgi0p$r76$1@speranza.aioe.org>, aaa <aaa@aaaaaaaaaaa.com> wrote: > Hello, > Why is this: > fseek($f, 0x0000+2, SEEK_SET); > giving same result as: > fseek($f, 4, SEEK_SET); > and not same result as: > fseek($f, 0000+2, SEEK_SET); > or > fseek($f, 2, SEEK_SET); > ? > What is wrong with the hex notation? What does it give you if you just print the expressions instead? Cheers Tony -- Tony Mountifield Work: tony@softins.co.uk - http://www.softins.co.uk Play: tony@mountifield.org - http://tony.mountifield.org
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2012-02-15 16:48 +0000 |
| Message-ID | <4f3be1da$0$8669$a8266bb1@newsreader.readnews.com> |
| In reply to | #4819 |
On Wed, 15 Feb 2012 16:12:43 +0100, aaa wrote: > Hello, > Why is this: > fseek($f, 0x0000+2, SEEK_SET); > giving same result as: > fseek($f, 4, SEEK_SET); > and not same result as: > fseek($f, 0000+2, SEEK_SET); > or > fseek($f, 2, SEEK_SET); > ? > What is wrong with the hex notation? from "http://uk.php.net/manual/en/function.fseek.php" we find that "Upon success, returns 0; otherwise, returns -1." Perhaps the problem is actually with "what happens next" when taken in the context of "what the file contains". Rgds Denis McMahon
[toc] | [prev] | [next] | [standalone]
| From | "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> |
|---|---|
| Date | 2012-02-15 18:48 +0100 |
| Message-ID | <jhgr5c$4fm$1@dont-email.me> |
| In reply to | #4819 |
El 15/02/2012 16:12, aaa escribió/wrote: > Why is this: > fseek($f, 0x0000+2, SEEK_SET); > giving same result as: > fseek($f, 4, SEEK_SET); > and not same result as: > fseek($f, 0000+2, SEEK_SET); > or > fseek($f, 2, SEEK_SET); > ? > What is wrong with the hex notation? It's really funny: var_dump(0x0 + 2, 0x0+ 2, 0x0+2, 0x0 +2); ... prints: int(2) int(2) int(4) int(4) No idea of what's going on but it only seems to affect hexadecimal zero so at least there's an obvious workaround. -- -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain -- Mi sitio sobre programación web: http://borrame.com -- Mi web de humor satinado: http://www.demogracia.com --
[toc] | [prev] | [next] | [standalone]
| From | "aaa" <aaa@aaaaaaaaaaa.com> |
|---|---|
| Date | 2012-02-16 10:38 +0100 |
| Message-ID | <jhiipg$flp$1@speranza.aioe.org> |
| In reply to | #4823 |
> It's really funny: > > var_dump(0x0 + 2, 0x0+ 2, 0x0+2, 0x0 +2); > > ... prints: > > int(2) > int(2) > int(4) > int(4) > > No idea of what's going on but it only seems to affect hexadecimal zero so > at least there's an obvious workaround. Yeah. I already reported that bug to PHP guys, so perhaps 5.2.11 will have it fixed. I spent like 5 hours trying to figure out what's wrong with my code ;/ -- A
[toc] | [prev] | [next] | [standalone]
| From | "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> |
|---|---|
| Date | 2012-02-16 14:08 +0100 |
| Message-ID | <jhiv4v$d0n$1@dont-email.me> |
| In reply to | #4829 |
El 16/02/2012 10:38, aaa escribió/wrote: >> It's really funny: >> >> var_dump(0x0 + 2, 0x0+ 2, 0x0+2, 0x0 +2); >> >> ... prints: >> >> int(2) >> int(2) >> int(4) >> int(4) >> >> No idea of what's going on but it only seems to affect hexadecimal zero so >> at least there's an obvious workaround. > > Yeah. I already reported that bug to PHP guys, so perhaps 5.2.11 will have > it fixed. And it seems it's a valid bug: https://bugs.php.net/bug.php?id=61095 -- -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain -- Mi sitio sobre programación web: http://borrame.com -- Mi web de humor satinado: http://www.demogracia.com --
[toc] | [prev] | [next] | [standalone]
| From | Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> |
|---|---|
| Date | 2012-02-16 12:37 +0100 |
| Message-ID | <jhippl$5tq$1@news.albasani.net> |
| In reply to | #4823 |
Álvaro G. Vicario schrieb: > It's really funny: > > var_dump(0x0 + 2, 0x0+ 2, 0x0+2, 0x0 +2); > > ... prints: > > int(2) > int(2) > int(4) > int(4) This bug does not seem to occur with PHP 5.2 (Tested with 5.2.12). So it was probably introduced with PHP 5.3 (and is still present in 5.4.0alpha3). Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche)
[toc] | [prev] | [next] | [standalone]
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
|---|---|
| Date | 2012-02-15 20:00 +0100 |
| Message-ID | <9q2dmfF68gU2@mid.uni-berlin.de> |
| In reply to | #4819 |
Am 15.02.2012 16:12, schrieb aaa: > Hello, > Why is this: > fseek($f, 0x0000+2, SEEK_SET); > giving same result as: > fseek($f, 4, SEEK_SET); > and not same result as: > fseek($f, 0000+2, SEEK_SET); > or > fseek($f, 2, SEEK_SET); > ? > What is wrong with the hex notation? > About hex numbers and strings of hex numbers see thread "Implied cast differs from explicit cast". It looks like PHP is not very consistent there. /Str.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web