Bug #69421 [NEW]: getopt() fails when daemoning php file
| From: | nanocaiordo at gmail dot com | Date: | Fri, 10 Apr 2015 17:34:16 +0000 |
| Subject: | Bug #69421 [NEW]: getopt() fails when daemoning php file | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-191945@lists.php.net to get a copy of this message | ||
From: nanocaiordo at gmail dot com
Operating system: CloudLinux 6.6
PHP version: 5.4.39
Package: CGI/CLI related
Bug Type: Bug
Bug description:getopt() fails when daemoning php file
Description:
------------
getopt() return false when daemonizing a PHP script, $argv is properly
filled up with all the arguments but getopt() keeps returning false.
Calling the script without 'deamon --pidfile' does work, however
something strange is that it outputs X-Powered-By and Content-type in
CLI when getopt() fails.
Test script:
---------------
test.sh
#!/bin/bash
. /etc/rc.d/init.d/functions
daemon --pidfile=test.pid test.php -P Pdegub
test.php
#!/usr/bin/env php
<?php
error_reporting(-1);
ini_set('display_errors', 1);
exit(var_dump(getopt('P:')));
Expected result:
----------------
sh ./test.sh
array(1) {
["P"]=>
string(6) "Pdebug"
}
Actual result:
--------------
sh ./test.sh
X-Powered-By: PHP/5.4.39
Content-type: text/html
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=69421&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69421&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69421&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69421&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69421&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69421&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69421&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69421&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69421&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69421&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69421&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69421&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69421&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69421&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69421&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69421&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69421&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69421&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69421&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69421&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69421&r=mysqlcfg