php-general Digest 12 Oct 2009 18:10:52 -0000 Issue 6387

2009-10-12 Thread php-general-digest-help
php-general Digest 12 Oct 2009 18:10:52 - Issue 6387 Topics (messages 298849 through 298870): Re: security/deployment issue 298849 by: James McLean Re: Need unrounded precision 298850 by: Arno Kuhl 298851 by: Chetan Rane 298858 by: Diogo Neves 298862

RE: [PHP] Need unrounded precision

2009-10-12 Thread Arno Kuhl
-Original Message- From: Andre Dubuc [mailto:aajdu...@webhart.net] Sent: 02 January 2010 03:20 AM To: php-general@lists.php.net Subject: [PHP] Need unrounded precision Hi, I need to extract the first digit after the decimal point from a number such as 28.56018, which should be '5'.

RE: [PHP] Need unrounded precision

2009-10-12 Thread Chetan Rane
May be this will work $elapsed = 28.56018; $elapsed_rel = (int) 28.56018; $elapsed_deci = $elapsed - $elapsed_rel; $deci = ((int) ($elapsed_deci * 10))/10; $final = $elapsed_rel + $deci; With regards, Chetan Dattaram Rane | Software Engineer | Persistent Systems chetan_r...@persistent.co.inĀ  |

Re: [PHP] Re: php exception handling

2009-10-12 Thread kranthi
cant http://us3.php.net/manual/en/function.set-exception-handler.php be used ? ?php function exception_handler($e) { //mail('to', 'exception', $e-getMessage()); } set_exception_handler('exception_handler'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] VC9 x86 Non Thread Safe or VC9 x86 Thread Safe ?

2009-10-12 Thread loki
Hello, We use Php-cgi.exe as FastCGI with our own custom WebServer on Windows Server What to choose, VC9 x86 Non Thread Safe or VC9 x86 Thread Safe ? We have these enviroment variable : PHP_FCGI_CHILDREN: 8 Thanks you by advance stephane -- Http://www.arkadia.com/fra/

Re: [PHP] Re: Insult my code!

2009-10-12 Thread David Otton
2009/10/11 Eric Bauman baum...@livejournal.dk: As before, please feel free to insult my code. ;-) Any and all feedback is of course most appreciated. I know you're more concerned with structure, but your checkInt() method is arguably buggy/has an un-noted assumption. It accepts ints formatted

Re: [PHP] VC9 x86 Non Thread Safe or VC9 x86 Thread Safe ?

2009-10-12 Thread Tommy Pham
- Original Message From: loki loki5100-newsgr...@yahoo.fr To: php-general@lists.php.net Sent: Mon, October 12, 2009 3:13:41 AM Subject: [PHP] VC9 x86 Non Thread Safe or VC9 x86 Thread Safe ? Hello, We use Php-cgi.exe as FastCGI with our own custom WebServer on Windows Server

Re: [PHP] How do YOU set default function/method params?

2009-10-12 Thread Stephan Ebelt
On Sun, Oct 11, 2009 at 01:17:00PM -0700, Jim Lucas wrote: Stephan Ebelt wrote: On Mon, Oct 05, 2009 at 05:48:32PM -0700, Jim Lucas wrote: Here is a problem that I have had for years now. I have been trying to come up with the perfect solution for this problem. But, I have come down to

Re: [PHP] How do YOU set default function/method params?

2009-10-12 Thread David Otton
2009/10/12 Stephan Ebelt s...@shared-files.de: as far as I understood/use it: I try to hardcode as many workable defaults in the vo class as possible (ie. see $subject in the example). Then I create objects by passing result records from the database (arrays) to the constructor. That either

Re: [PHP] Need unrounded precision

2009-10-12 Thread Diogo Neves
A simple way to do that would be: $elapsed = strval( 28.56018 ); $pos = strpos( $elapsed, '.' ); echo $elapsed[ ++$pos ]; On Sat, Jan 2, 2010 at 2:20 AM, Andre Dubuc aajdu...@webhart.net wrote: Hi, I need to extract the first digit after the decimal point from a number such as 28.56018,

[PHP] Wrighting to $_POST array

2009-10-12 Thread hessiess
I have some code which will loop over the whole $_POST array, runs it through mysql_real_escape_string and then writes it all back to the array again, which seams to work. Are there any incompatibility problems or such like with writing into the $_POST or $_GET array? function clean_post()

Re: [PHP] Wrighting to $_POST array

2009-10-12 Thread Jay Ess
hessi...@hessiess.com wrote: I have some code which will loop over the whole $_POST array, runs it through mysql_real_escape_string and then writes it all back to the array again, which seams to work. Are there any incompatibility problems or such like with writing into the $_POST or $_GET

Re: [PHP] Wrighting to $_POST array

2009-10-12 Thread Jim Lucas
Jay Ess wrote: hessi...@hessiess.com wrote: I have some code which will loop over the whole $_POST array, runs it through mysql_real_escape_string and then writes it all back to the array again, which seams to work. Are there any incompatibility problems or such like with writing into the

RE: [PHP] Wrighting to $_POST array

2009-10-12 Thread Andrea Giammarchi
But, first, you need to use get_magic_quotes_gpc() to see if magic_quotes_gpc is turned on. If so, you need to run stripslashes() on your variables before you run the mysql_real_escape_string() on them. if ( get_magic_quotes_gpc() ) { $_POST = array_map('stripslashes', $_POST);

[PHP] exec() confused by a specially crafted string

2009-10-12 Thread Soner Tari
When shell command returns a specially crafted string, I get an empty array as $output of exec(), instead of the string. I can very easily reproduce this issue as follows: Put the following lines in bug.php: ?php exec('php echostr.php', $output); print_r($output); echo \n; ? Then put the

Re: [PHP] exec() confused by a specially crafted string

2009-10-12 Thread Jonathan Tapicer
Confirmed, it also happens to me on Linux, PHP version: PHP 5.2.4-2ubuntu5.7 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2009 19:52:39) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies And adding a single character to the echoed string makes

RE: [PHP] Need unrounded precision

2009-10-12 Thread Andrea Giammarchi
Hmmm... Didn't think about this, but % only works with int values it was just future prof precaution since this statement is false for many other languages. In few words I am not sure PHP6 does the same ... never mind so far Regards

RE: [PHP] Need unrounded precision

2009-10-12 Thread Jaime Bozza
Hmmm... Didn't think about this, but % only works with int values it was just future prof precaution since this statement is false for many other languages. In few words I am not sure PHP6 does the same ... never mind so far Good to know. In that case, I would probably just use intval()

RE: [PHP] Need unrounded precision

2009-10-12 Thread Andrea Giammarchi
Couldn't this be done with just simple math functions? indeed: $a = 28.56018; $b = $a * 10 % 10 0; Regards _ Windows Live Hotmail: Your friends can get your Facebook updates, right

RE: [PHP] Need unrounded precision

2009-10-12 Thread Jaime Bozza
-Original Message- From: Diogo Neves [mailto:dafne...@gmail.com] Sent: Monday, October 12, 2009 9:19 AM To: Andre Dubuc Cc: php-general@lists.php.net Subject: Re: [PHP] Need unrounded precision A simple way to do that would be: $elapsed = strval( 28.56018 ); $pos = strpos(

RE: [PHP] Need unrounded precision

2009-10-12 Thread Jaime Bozza
Couldn't this be done with just simple math functions? indeed: $a = 28.56018; $b = $a * 10 % 10 0; Hmmm... Didn't think about this, but % only works with int values, so $b = $a * 10 % 10; Should work as well. Jaime -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] exec() confused by a specially crafted string

2009-10-12 Thread Soner Tari
On Mon, 2009-10-12 at 13:21 -0300, Jonathan Tapicer wrote: Confirmed, it also happens to me on Linux, PHP version: PHP 5.2.4-2ubuntu5.7 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2009 19:52:39) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend

Re: [PHP] How do YOU set default function/method params?

2009-10-12 Thread Stephan Ebelt
On Mon, Oct 12, 2009 at 01:44:56PM +0100, David Otton wrote: 2009/10/12 Stephan Ebelt s...@shared-files.de: as far as I understood/use it: I try to hardcode as many workable defaults in the vo class as possible (ie. see $subject in the example). Then I create objects by passing

Re: [PHP] exec() confused by a specially crafted string

2009-10-12 Thread Eddie Drapkin
On Mon, Oct 12, 2009 at 2:10 PM, Soner Tari so...@comixwall.org wrote: On Mon, 2009-10-12 at 13:21 -0300, Jonathan Tapicer wrote: Confirmed, it also happens to me on Linux, PHP version: PHP 5.2.4-2ubuntu5.7 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2009 19:52:39) Copyright (c)

RE: [PHP] Need unrounded precision

2009-10-12 Thread Andrea Giammarchi
bitwise right shift is probably the fastest cast to int so far ... still in many languages, intval is a function call being a cast in both cases (int) is good as well ... bitwise, casting, works with strings, arrays, boolean, whatever as well. I don't think there is any difference in php,

[PHP] libphp5.so rebuild required?

2009-10-12 Thread SAILESH KRISHNAMURTI, BLOOMBERG/ 731 LEXIN
Hi, We are looking to upgrade php 5.2.1 to 5.2.8. Do we need to rebuild the libphp5.so also to detect the new version of underlying php or will the same old version of libphp5.so build for php 5.2.1, automatically detect a new underlying php installation? thanks

[PHP] How to bypass (pipe) curl_exec return value directly to a file?

2009-10-12 Thread m.hasibuan
Newbie question. I need to download a very large amount of xml data from a site using CURL. How to bypass (pipe) curl_exec return value directly to a file, without using memory allocation? set_time_limit(0); $ch = curl_init($siteURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $mixed =

Re: [PHP] Re: Insult my code!

2009-10-12 Thread Eric Bauman
On 12/10/2009 9:21 PM, David Otton wrote: 2009/10/11 Eric Baumanbaum...@livejournal.dk: As before, please feel free to insult my code. ;-) Any and all feedback is of course most appreciated. I know you're more concerned with structure, but your checkInt() method is arguably buggy/has an