ID:               43132
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jpozzoli at yahoo dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         CGI related
 Operating System: Debian Linux 2.6.18-5-686
 PHP Version:      5.2.0


Previous Comments:
------------------------------------------------------------------------

[2007-10-30 16:03:29] jpozzoli at yahoo dot com

I'll get the CVS, but just for your reference, here's a composite of
several screens showing this "error", with the actual PHP code in the
box to the right.

http://www.flipnut.com/php-bug-43132.jpg

------------------------------------------------------------------------

[2007-10-30 11:03:41] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

I can't reproduce this.

------------------------------------------------------------------------

[2007-10-29 19:57:00] jpozzoli at yahoo dot com

Description:
------------
This is on Debian PHP version 5.2.0-8+etch7 running on Apache/2.2.3 


When trying to get the last reboot date of a linux server, from the
command line I run "who -b". More precisely, I run "who -b|awk \'{print
$3" "$4}\'" which, on the CLI, returns "2007-10-18 04:45". When I run
the PHP command echo exec('who -b|awk \'{print $3" "$4}\''); I get the
following result: Oct 18

Obviously, this has been formatted by PHP.

To make sure of this, I tried this:
$rebootdate = strftime("%m-%d-%Y %I:%M%p",
strtotime($rebootdateexec));

This get's closer. It outputs "10-18-2007 12:00AM". So it got the date
but missed the time.

Reproduce code:
---------------
$rebootdateexec = exec('who -b|awk \'{print $3" "$4}\'');

echo $rebootdateexec;

$rebootdate = strftime("%m-%d-%Y %I:%M%p",
strtotime($rebootdateexec));

echo $rebootdate;

Expected result:
----------------
$rebootdateexec = 2007-10-18 04:45

$rebootdate = 10-18-2007 04:45AM

Actual result:
--------------
$rebootdateexec = Oct 18

$rebootdate = 10-18-2007 12:00AM


------------------------------------------------------------------------


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

Reply via email to