[PHP-DEV] Bug #14278 Updated: Analyzed: Probably OCI related? string-int type casting problem for sure!
ID: 14278 User updated by: [EMAIL PROTECTED] Old Summary: % and / bug with INTEGERs! Reported By: [EMAIL PROTECTED] Old Status: Closed Status: Open Bug Type: Math related Operating System: Linux 2.2.19 PHP Version: 4.0.6 New Comment: After some more investigation on this bug I noticed following: I have an OCI insert statement executed with a 'RETURNING INTO' clause. The value which is returned is a oracle DB entry of type NUMBER. I expected to have the returned value in PHP to be a number as well. BUT it is a string! Some more output I produced in my script is: ? echo($num (type: .gettype($num).[.strlen($num).] - .($num*1).)); ? The result (when the error occures): 106851 (type: string[6] - 1068514) As you can see the value of the $num variable changes while automatic type casting from string to int is executed. The reason for the NEW (bigger) value is possibly a not null terminated string value returned by the OCI interface. My suggestion: While typecasting from string to int an extra check should be done (e.g. detect if there is a null terminated string and if not: terminate it). Thanks for your patch! Previous Comments: [2001-12-20 12:48:09] [EMAIL PROTECTED] No feedback. Closing. [2001-11-29 15:42:41] [EMAIL PROTECTED] E:\phpphp -v 4.0.6 E:\phpphp -q test.php 101110 22 3888 14 149 19 5 5 0 0 0 0 AAFTOW No matter how many times I run this script I always get this. Also tested it on Linux (2.4), with PHP 4.2.0-dev and it works. Please try a newer version and see if that fixes the problem you're having. http://www.php.net/~zeev/php-4.1.0RC3.tar.gz or http://snaps.php.net/php4-latest.tar.gz -Chris [2001-11-29 05:27:51] [EMAIL PROTECTED] Sometimes (1 - 10 times a day) I get a strange error on one of my production servers. See this function: function MakeHash($num) { $ret = ; $ca = array(); for ($i = 0; $i 6; $i++) { $c = $num % 26; $ca[] = $num $c; $ret = sprintf(%c, 65+$c).$ret; $num = ($num-$c)/ 26; } // Send $ca array via email to me (removed) return $ret; } Sometimes calling this function with an INT it calculates wired results... If that happens I mail the $ca array to myself and see what it does: 101110 19 (MEANS: 101110 % 26 is 19!? That's wrong, it is 22) 3588 24 (MEANS 101110 / 26 is 3588, but it is 3888) 1495714 12... 57527 15 2212 2 85 7 What goes wrong? In the beginning the % result is wrong, and then the division result is wrong too... any suggestions!? /mike Edit this bug report at http://bugs.php.net/?id=14278edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #14947: not null terminated RETURNING INTO values?
From: [EMAIL PROTECTED] Operating system: Linux PHP version: 4.0.6 PHP Bug Type: OCI8 related Bug description: not null terminated RETURNING INTO values? Please see bug report 14278 for details! ( http://bugs.php.net/bug.php?id=14278 ) Thanks, Mike -- Edit bug report at: http://bugs.php.net/?id=14947edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #14947 Updated: not null terminated RETURNING INTO values?
ID: 14947 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: OCI8 related Operating System: Linux PHP Version: 4.0.6 New Comment: The original bug # is OPEN but related to another topic... my intention was to have informed to oci8 interface developers as well. /mike Previous Comments: [2002-01-09 09:44:04] [EMAIL PROTECTED] no need for second report (the old one is still open and valid) [2002-01-09 09:26:22] [EMAIL PROTECTED] Please see bug report 14278 for details! ( http://bugs.php.net/bug.php?id=14278 ) Thanks, Mike Edit this bug report at http://bugs.php.net/?id=14947edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #14456: mcrypt_create_iv: unterminated string segfault
From: [EMAIL PROTECTED] Operating system: Linux 2.2.X PHP version: 4.1.0 PHP Bug Type: mcrypt related Bug description: mcrypt_create_iv: unterminated string segfault mcrypt_create_iv(mcrypt_get_iv_size (MCRYPT_DES , MCRYPT_MODE_ECB), MCRYPT_RAND) produces following error and causes apache to segfault: Warning - String is not zero-terminated source: zend_execute_API.c:274 Workaround: Replace the mcrypt_create_iv call with: $fp = fopen(/dev/random, r); $iv = fread($fp, mcrypt_get_iv_size (MCRYPT_DES , MCRYPT_MODE_ECB)); fclose($fp); Better: Should be fixed. -- Edit bug report at: http://bugs.php.net/?id=14456edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #14426: static function definition in php_gd.h has to be extern
From: [EMAIL PROTECTED] Operating system: Linux 2.2.X PHP version: 4.1.0 PHP Bug Type: Compile Failure Bug description: static function definition in php_gd.h has to be extern The function definition in ext/gd/php_gd.h for gdImageColorResolve has to be changed from 'static' into 'extern', otherwise compile errors are to be expected (at least with gd version older than 1.6) (Error message is undefined reference to `gdImageColorResolve') -- Edit bug report at: http://bugs.php.net/?id=14426edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #14278: % and / bug with INTEGERs!
From: [EMAIL PROTECTED] Operating system: Linux 2.2.19 PHP version: 4.0.6 PHP Bug Type: Math related Bug description: % and / bug with INTEGERs! Sometimes (1 - 10 times a day) I get a strange error on one of my production servers. See this function: function MakeHash($num) { $ret = ; $ca = array(); for ($i = 0; $i 6; $i++) { $c = $num % 26; $ca[] = $num $c; $ret = sprintf(%c, 65+$c).$ret; $num = ($num-$c)/ 26; } // Send $ca array via email to me (removed) return $ret; } Sometimes calling this function with an INT it calculates wired results... If that happens I mail the $ca array to myself and see what it does: 101110 19 (MEANS: 101110 % 26 is 19!? That's wrong, it is 22) 3588 24 (MEANS 101110 / 26 is 3588, but it is 3888) 1495714 12... 57527 15 2212 2 85 7 What goes wrong? In the beginning the % result is wrong, and then the division result is wrong too... any suggestions!? /mike -- Edit bug report at: http://bugs.php.net/?id=14278edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10905: ImageGif (ImagePNG) output uncompressed
From: [EMAIL PROTECTED] Operating system: Linux PHP version: 4.0.5 PHP Bug Type: Output Control Bug description: ImageGif (ImagePNG) output uncompressed Using the compression ob_gzhandler all HTML Pages get compressed well. But dynamic generated Images don't get compressed. Header of the output says, it is compressed, but the data following the header isn't. So those images can't be displayed (by at least netscape) Thanks for the patch, ;-) mike PS: Don't tell me that it isn't useful to gzip images, but if you have switched compression to 'enabled' in your php.ini file and you are creating images on the fly, you'll need it to handle this case correctly. -- Edit Bug report at: http://bugs.php.net/?id=10905edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]