note 93526 added to function.system
| From: | malte dot riesch at gmx dot net | Date: | Mon, 14 Sep 2009 15:10:11 +0000 |
| Subject: | note 93526 added to function.system | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160549@lists.php.net to get a copy of this message | ||
This might be a bug, but be aware that the system function, at least on PHP 5.2 on Linux, disrupts
the output buffering process:
Consider something along the lines of:
<?php
ob_start();
system('pwd');
header("location: http://news.bbc.co.uk");
ob_end_clean();
?>
This will not redirect to the bbc site as it seems an (invisible) output has already been written
even though it was supposed to be captured. Consider using another function like exec() instead as a
workaround as replacing system('pwd') with echo exec('pwd') will work as
expected.
----
Server IP: 87.124.86.47
Probable Submitter: 188.220.60.237 (proxied: 188.220.60.237)
----
Manual Page -- http://www.php.net/manual/en/function.system.php
Edit -- https://master.php.net/note/edit/93526
Del: integrated -- https://master.php.net/note/delete/93526/integrated
Del: useless -- https://master.php.net/note/delete/93526/useless
Del: bad code -- https://master.php.net/note/delete/93526/bad+code
Del: spam -- https://master.php.net/note/delete/93526/spam
Del: non-english -- https://master.php.net/note/delete/93526/non-english
Del: in docs -- https://master.php.net/note/delete/93526/in+docs
Del: other reasons-- https://master.php.net/note/delete/93526
Reject -- https://master.php.net/note/reject/93526
Search -- https://master.php.net/manage/user-notes.php