Re: [PHP] php-cli

2010-03-14 Thread Dmitry Ruban

Rick Pasotto wrote:

On Sun, Mar 14, 2010 at 08:40:51PM +, Ashley Sheridan wrote:

On Sun, 2010-03-14 at 16:41 -0400, Rick Pasotto wrote:


On Sun, Mar 14, 2010 at 06:13:24PM +, Ashley Sheridan wrote:

On Sun, 2010-03-14 at 14:15 -0400, Rick Pasotto wrote:


Has cli php changed recently?

I've got a php script (script1) that creates a php script (script2) by
opening a file and then writing to it. When I try to run it from the
command line script1 is simply copied to stdout. When I run it from the
browser it works as expected. The directory has 777 permissions so that
should not be the problem.

Any ideas?

How are you running it from the command line?

Is there more than one way? I suppose with and without the -f could
count as two ways, but the man page says without defaults to with so
they're really the same.

Well you havn't given an example, and just say you're calling the script
from command line and it's outputting the script there. Are you maybe
just calling the php file without calling php first?


Of course not. php scripts are not executable. If I had tried to execute
it directly the shell would have told me that. If I had then set the
executable bit the shell would have tried to execute the contents of the
file and the shell would have given several error messages.

I repeat: is there more than one way to run a php script from the cli?



On *nix, you can add #!/usr/bin/php as first line and make file 
executable (chmod +x).


--
Dmitry

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php-cli

2010-03-14 Thread Dmitry Ruban

Rick Pasotto wrote:

On Mon, Mar 15, 2010 at 01:32:24PM +1300, Dmitry Ruban wrote:

Rick Pasotto wrote:

I repeat: is there more than one way to run a php script from the cli?


On *nix, you can add #!/usr/bin/php as first line and make file
executable (chmod +x).


Functionally the same. php is still interpreting the script. The script
is still not an executable.

And, of course, the results are the same.

The problem is that php is *not* interpreting the script. It's acting
like 'cat'.



It sounds like you may use short tags ? and short_open_tag is off in 
your cli php.ini


What does it show:

php -r 'phpinfo();' | grep short

--
Dmitry

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Division by 0

2010-03-10 Thread Dmitry Ruban

Hi Jochem,

Jochem Maas wrote:

Op 3/10/10 6:23 PM, Joseph Thayne schreef:

Looks to me like you are closing your form before you put anything in
it.  Therefore, the loan_amount is not set making the value 0.  Follow
the math, and you are dividing by 1-1.

Change this line:

form action=?php echo $_SERVER['PHP_SELF']; ? method=post/form

to:

form action=?php echo $_SERVER['PHP_SELF']; ? method=post


this is a XSS waiting to happen. I can put something like the following in
the request uri:

index.php? onsubmit=evil()script src=http://www.evil.com/evi.js;/script

Apparently it's not going to work. PHP_SELF does not include query 
string. So it is safe to use it this way.


Regards,
Dmitry


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XMLRPC issue

2010-03-03 Thread Dmitry Ruban

Hi all,

I was upgrading php from 5.6 to 5.11 and came across one odd issue. Hope 
someone could point out what is the problem.


Following code demonstrates it:

$xml = '?xml version=1.0 
encoding=UTF-8?methodResponseparamsparamvaluelt;Test/gt;/value/param/params/methodResponse';


echo xmlrpc_decode($xml);

I suspect to get Test/ as a result, but for some reason  and  are 
cut out and i'm getting Test/. So basically all entities are dropped 
from response.


I have 2nd server running same OS (CentOS 5) which has been upgraded 
first and it works as i suspect, code above shows Test/.


Any advice will be much appreciated.

Currently I have temporary workaround for this:

$xml = str_replace(array('lt;','gt;'), array('#60;','#62;'), $xml);

but would like to fix xmlrpc somehow.

Regards,
Dmitry Ruban




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] sessions handling

2004-06-02 Thread Dmitry Ruban
Hi folks,

We have two instances of apache/mod_php running on 80 and 443 ports
accordingly. For both mod_php we have the same dir (/tmp) to store session
information. Is it possible to mix sessions data up if user switches between
80 and 443 ports? I mean what if when user surfs over 80 port and has
already sessionID in this mod_php context(PHPSESSID stores in cookie), then
he jumps to 443 instance, would that mod_php correctly find proper session
file? Is it possible that PHPSESSID in 443 context hasn't been initialized
and mod_php won't get proper file?

Regards,
Dima Ruban

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php