#28975 [Com]: printf("%6.2f") and values less than 1 gives wrong output

2004-07-19 Thread christophe dot bidaux at netcourrier dot com
 ID:   28975
 Comment by:   christophe dot bidaux at netcourrier dot com
 Reported By:  phpbug at billix dot franken dot de
 Status:   Open
 Bug Type: Output Control
 Operating System: Linux
 PHP Version:  Irrelevant
 New Comment:

i have the same problem between the 4.3.4 and the 4.3.8 php version, on
windows system...

i made some new tests and i think that when the value is less than 1,
in 4.3.8, the number of digits before the decimal-point in the sprintf
(6 in the example) is used as the number of digits before the
decimal-point in the returned value (00.50), whereas in the 4.3.4
version, this value is used for the length of the entire value
(included the decimal-point).


Previous Comments:


[2004-07-16 10:05:13] arattink at correct dot net

Line 401/403 in ext/standard/formatted_printf.c should be 
removed.  
 
/*  if (precision > 0) { 
width += (precision + 1);
}*/ 
 
I'm not a PHP-developer, but 'width' passed to 
php_sprintf_appenddouble should be passed on to 
php_sprintf_appendstring unaltered. It seems that in most cases 
precision is garbled to 0 so it works most of the time.



[2004-06-30 17:40:38] phpbug at billix dot franken dot de

Description:

A printf of float values less than 1 gives an incorrect output. It
looks like the numbers before the dot equal the width specifier...

This happens with every tested PHP version (4.3.7, 5.0.0RC3 and CVS)

With PHP 4.3.6 both outputs were wrong...

Oliver

Reproduce code:
---
$a = sprintf ( "%06.2f" , 0.5 );
$b = sprintf ( "%06.2f" , 1.5 );
var_dump($a);
var_dump($b);


Expected result:

string(6) "000.50"
string(6) "001.50"


Actual result:
--
string(9) "00.50"
string(6) "001.50"






-- 
Edit this bug report at http://bugs.php.net/?id=28975&edit=1


#24828 [NEW]: round() function doesn't round !

2003-07-27 Thread christophe dot bidaux at netcourrier dot com
From: christophe dot bidaux at netcourrier dot com
Operating system: Windows 98SE
PHP version:  4CVS-2003-07-27 (stable)
PHP Bug Type: Math related
Bug description:  round() function doesn't round !

Description:

the round() function doesn't give me the results described in the
documentation example.


Reproduce code:
---
// from the documentation example

$foo = round( 3.4 );   // $foo == 3.0
var_dump($foo);

$foo = round( 3.5 );   // $foo == 4.0
var_dump($foo);

$foo = round( 3.6 );   // $foo == 4.0
var_dump($foo);


Expected result:

float(3) float(4) float(4)

(PHP Version 4.3.3RC1 version)

Actual result:
--
float(3) float(3) float(3)

(PHP Version 4.3.3RC2-dev (Jul 27 2003 10:11:04) version)

-- 
Edit bug report at http://bugs.php.net/?id=24828&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24828&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24828&r=trysnapshot5
Fixed in CVS:   http://bugs.php.net/fix.php?id=24828&r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=24828&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24828&r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=24828&r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=24828&r=support
Expected behavior:  http://bugs.php.net/fix.php?id=24828&r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=24828&r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=24828&r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=24828&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24828&r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=24828&r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=24828&r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=24828&r=gnused



#23808 [Com]: Different behaviour of gd in blend images with 4.3.2rc4 than 4.3.1

2003-07-01 Thread christophe dot bidaux at netcourrier dot com
 ID:   23808
 Comment by:   christophe dot bidaux at netcourrier dot com
 Reported By:  i dot a at signalsystem-bz dot it
 Status:   Open
 Bug Type: GD related
 Operating System: Win2k server
 PHP Version:  4.3.2RC4
 New Comment:

i made new tests with several php versions and i've putted the results
on this page :
http://christophe.bidaux.free.fr/imagecopymerge/imagecopymerge.html

the first image is the original image and the others are made with the
same php program shown at the bottom.

the php version is written in the top-left corner of the images.

only the 4.3.1 version gives me a good result.

i use the binaries as they are and i use the same php.ini for all my
tests.

i run php on an Apache/1.3.20 Server on Windows 98.


Previous Comments:


[2003-06-03 07:35:26] tozz at kijkt dot tv

I experience the same bug on Linux with PHP 4.3.2, on PHP 4.3.1
everything works fine.

Configure line:
'./configure' '--with-apxs' '--with-mysql' '--enable-ftp'
'--with-openssl' '--with-gd' '--enable-bcmath' '--enable-dbase'
'--with-freetype-dir' '--with-ttf' '--with-jpeg-dir=/usr/lib'
'--with-png-dir=/usr/lib' '--with-zlib-dir=/usr/lib/' 

The code:

imagecopymerge ($board, $pawn, $w1, $h1, 0, 0, $w, $h, 30);
imagecopymerge ($board, $pawn, $w2, $h2, 0, 0, $w, $h, 30);
imagedestroy ($pawn);
Imagejpeg($board,'',100);



[2003-06-03 02:01:27] i dot a at signalsystem-bz dot it

I putted the images as you requested ..
http://signalsystem.merseine.nu/test/

image1.jpg is the main image;
image2.png is the image that's "slitted" in trasnparency over the
first

image_431.jpg is the result of it in 4.3.1 (nice and good)
image_432.jpg is the result of it in 4.3.2 (wrong and ugly)



[2003-06-01 04:28:05] phpuser at panoramas dot de

I was going to file this as a new bug, but thought i'd rather add it
here, since it's the same basic problem:

After upgrading to 4.3.2, the imagecopymerge function is broken.
Reverting to 4.3.1 removes the error.

My configure line: (unchanged since 4.3.1)
'./configure' '--with-mysql' '--prefix=/mysrv/php' '--enable-ftp'
'--with-apxs=/mysrv/apache/sbin/apxs'
'--with-config-file-path=/mysrv/php-conf' '--disable-pear'
'--enable-track-vars' '--with-gd' '--with-jpeg-dir=/usr/local'
'--with-png-dir=/usr/local' '--with-zlib-dir=/usr/local'
'--disable-cli' '--with-t1lib=/usr/local'

Summary of script function:
- Takes one image A from file (JPEG 24bit).
- generates another image B with same dimensions, 24 bit, and fills it
with 50 percent gray
- (left out: gets a set of imagemap coordinates from a database and
draws them as black outline, white area inside the image B)
- merges image B on top of image A with 40 percent transparency
- returns the result.

Effect of error:
No blending occurs with 4.3.2. Only image B is returned, albeit
"weaker" or "stronger" depending on the transparency setting in
imagecopymerge().
Leaving out the imagecopymerge() command returns the original image A,
as expected.
Moving the coordinates results in a black background being visible
(should be image A). 

My unqualified guess:
Looks as if imagecopymerge() takes a black image instead of image A.

Side notes:
replacing imagecopymerge with imagecopymergegray actually returns the
both images overlaid, but with palette image color mixup effects.

Example source code
(requires a jpeg image "test.jpg" of arbitrary size to test)

-- begin code --

$uim = imagecreatefromjpeg("test.jpg")
or die ("Cannot Initialize new GD image stream");

imagealphablending ($uim, TRUE ); # leaving this out changes nothing

 fill overlay with gray

$im = imagecreatetruecolor( imagesx($uim) , imagesy($uim) ); #
Overlay-Bild

$migra=imagecolorallocate ($im, 128,128,128);

imagefilledrectangle ( $im , 0,0 , imagesx($im)-1 , imagesy($im)-1 ,
$migra );

# database drawin left out here

imagecopymerge ( $uim, $im, 0, 0, 0, 0, imagesx($uim), imagesy($uim),
40);

header ("Content-type: image/jpeg");
imagejpeg ($uim ,'', 75);

imagedestroy($uim);
imagedestroy($im);

-- end code --



[2003-05-30 08:32:21] [EMAIL PROTECTED]

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the s