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 Bauman: 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 acc

[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 = curl

[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

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, exce

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 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) 1997-2007 The PHP

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 : > > > 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 record

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] 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 unsubscrib

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 = s

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 f

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
> 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] 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

[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: Then put the following in echostr.php (the string is just one line actually, new lines

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', $_P

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 i

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 array?

[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] 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 wrote: > 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] How do YOU set default function/method params?

2009-10-12 Thread David Otton
2009/10/12 Stephan Ebelt : > 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 returns a objec

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 c

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

2009-10-12 Thread Tommy Pham
- Original Message > From: loki > 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 > What to choose, VC9

Re: [PHP] Re: Insult my code!

2009-10-12 Thread David Otton
2009/10/11 Eric Bauman : > 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 as ints and strings,

[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/ Http://www.arkadia.c

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 ? getMessage()); } set_exception_handler('exception_handler'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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Ā  | C