#43549 [Com]: changes made to htmlentities

2008-01-13 Thread yossi_shelli at cso dot co dot il
 ID:   43549
 Comment by:   yossi_shelli at cso dot co dot il
 Reported By:  mariusads at helpedia dot com
 Status:   Open
 Bug Type: Strings related
 Operating System: Redhat?,  Linux
 PHP Version:  5.2.5
 New Comment:

i have the same problem.

I'm using apache server on windows xp to develop my website.
while developing i had php 5.2.2 installed and all worked. today, while
showing the site to a friend of mine, i found out the text outputs, of
the user comments are not showing.

after playing a-bit. i found out the the htmlentities is the problem,
which worked fine before.

also, found out, that removing UTF-8 , will show text, but not in the
encoding which is needed to my website, which is hebrew.

from the first place, htmlentities , did not had a hebrew chars
support, so i used utf-8 which worked fine for me. now, utf-8 setting on
htmlentities resulting in NULL strings, and i don't have a solution to
my problem.


Previous Comments:


[2008-01-03 11:10:20] adam at shiftcreate dot com

I have the same problem - worked before 5.2.5



[2007-12-11 13:33:12] mariusads at helpedia dot com

small update: problem is solved kind of) if I don't specify 'UTF-8' or
if I use htmlspecialchars without 'UTF-8' (though the document looks
different than before, but I guess I'll just have to replace those ascii
characters with images, probably).



[2007-12-11 13:23:52] mariusads at helpedia dot com

The example you gave me does work but my issue has nothing to do with
receiving data in textarea or input boxes.

The page here:
hxxp://www.tgdb.net/pc/faq/5845/Diablo-page1.html

tries to open a text document from a certain location on the drive
which was previously uploaded by the user in a zip file.

If I change the example you gave me to read the text from a file:

html
head
meta http-equiv=content-type content=text/html; charset=utf-8 /
/head
body
pre
?php
$text = file_get_contents('a.txt');
  
var_dump($text);
var_dump(htmlentities($text,ENT_QUOTES,'UTF-8'));

?
/pre
form name=A method=post
textarea name=text/textarea
input name=sub type=submit value=submit/
/form
/body/html

which basically gets the text from the text file, htmlentities no
longer works as I expected it. I guess with your example, the browser
corrects the text pasted in the form before sending it to the script.

Almost all files I have are like the NFO files in scene releases, they
contain drawings made with ASCII characters, but I need them escaped
because the whole page is sent as UTF-8. They don't have multibyte stuff
on purpose and they're not corrupted or something like that.

It's also not feasible to tell the user to paste them in a text area in
a form, almost all submitted content is sent in a ZIP file and my
scripts extract the text file. Some files are also about 4-600KB in size
(walkthroughs) so using text area is out of the question.

I'm surprised to see that htmlentities returns a blank string and I
honestly don't know how to fix this so any help would be great.
Shouldn't it return the string up until the point where multibyte
characters are, whatever that means?

Could my problem be solved if I don't use the charset argument or if I
use htmlspecialchars? (i'll test...) Or is there another solution to my
predicament?

Thank you again for replying to my questions. I had bad experiences in
the past where other people just ignored my messages after replying with
works for me. I really appreciate it.



[2007-12-11 12:28:40] [EMAIL PROTECTED]

You never specified the charset for the page. This works fine:

html
head 
meta http-equiv=content-type content=text/html; charset=utf-8 /
/head
body
pre
?php
$text = isset($_REQUEST['text']) ? $_REQUEST['text'] : '';
  
var_dump($text);
var_dump(htmlentities($text,ENT_QUOTES,'UTF-8'));

?
/pre
form name=A method=post
textarea name=text/textarea
input name=sub type=submit value=submit/
/form
/body/html




[2007-12-10 11:45:38] mariusads at helpedia dot com

Just downloaded on my computer (Windows 2003, PHP 5.2.5 from website)
and the same problem occurs.

For example this one works: 

hxtp://devtgdb.definethis.org:90/pc/faq/5842/Diablo-page1.html

but this one doesn't:

hxtp://devtgdb.definethis.org:90/pc/faq/5845/Diablo-page1.html

The source code is identical, only difference is ads are disabled from
site config.
Also, if the links don't work, sorry, you may read this while I'm
sleeping and my computer is turned off. Otherwise, it's cable
4mbps/512kbps so they should work.

(again, please replace hxtp with http)



The remainder

#10411 [Com]: number_format returns wrong values

2004-09-21 Thread yossi_shelli at cso dot co dot il
 ID:   10411
 Comment by:   yossi_shelli at cso dot co dot il
 Reported By:  mark at artshouse dot com
 Status:   Closed
 Bug Type: Unknown/Other Function
 Operating System: Solaris 8, Slackware 7.0
 PHP Version:  4.0.4pl1
 New Comment:

I have the same problem here.
Running on windows 2000 , php version 4.3.7, Apache/2.0.49.

Tryed everything and every vriable with a number smaller then 1000
return a normal result. but a vriable with a number greater then 1000
return 1.00 as a result.

If i put a constant number instaed of vriable in the first parameter of
number_format (e.g. number_format (1099,2)) then the result will be ok.

My shop is also running on linux, tryed it on it, and the same results
:(

if anyone of u got answer to this problem, or a way to byepass it
please respond to this.

Yossi shelli


Previous Comments:


[2001-04-20 15:14:01] mark at artshouse dot com

That was just a typo on my part entering the information 
here.  The bug still exists, and I think it specifically 
has to do with values set as float,2 from MySQL. It doesn't 
happen every time, but I have seen this on at least 5 
occasions now (in 5 different sets of code).

I can recreate it within my code, but you don't want me to 
paste my code (its all intermingled in a 600 lines of 
script)

check it out specifically using values pulled from MySQL 
with a type of float,2.

Here's the kicker, if I do something like 
$total=number_format($totals,2); print $total; the bug 
exists...if I do print number_format($totals,2) it works 
normally.



[2001-04-19 17:53:57] [EMAIL PROTECTED]

Try changing:
$total = number_format($calcs_a + calcs_b,2);
to
$total = number_format($calcs_a + $calcs_b,2);
(Note the missing $)

Works just fine here with that small adjustment.



[2001-04-19 17:35:01] mark at artshouse dot com

number_format returns wrong values in certain situations, 
here is a code example...

$value = 504;
$calcs_a = number_format($value,2);

$othervalue = 504;
$calcs_b = number_format($othervalue,2);

$total = number_format($calcs_a + calcs_b,2);

this returns:
$calcs_a is 504.00
$calcs_b is 504.00
$total is 1.00  (should be 1008.00)

I have seen this on several occasions now on multiple 
machines/setups/Oses







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