Doc #54663 [Opn]: chdir() emits E_WARNING

From: Date: Thu, 30 Jun 2011 05:07:49 +0000
Subject: Doc #54663 [Opn]: chdir() emits E_WARNING
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6766@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54663&edit=1 ID: 54663 Updated by: philip@php.net Reported by: alex dot schuch at gmx dot de Summary: chdir() emits E_WARNING Status: Open Type: Documentation Problem Package: Documentation problem Operating System: -/- PHP Version: Irrelevant Block user comment: N Private report: N New Comment: The online documentation editor link relevant to this bug report: https://edit.php.net/?project=PHP&perm=en/function.chdir.php And the chdir() source code: http://lxr.php.net/opengrok/xref/PHP_5_3/ext/standard/dir.c#317 Previous Comments: ------------------------------------------------------------------------ [2011-05-04 20:32:39] alex dot schuch at gmx dot de Description: ------------ --- From manual page: http://www.php.net/function.chdir#Return Values --- The manual does not mention that chdir() emits an E_WARNING in case the directory cannot be changed. Test script: --------------- > php -a Interactive shell php > var_dump(chdir('/fghfgh')); PHP Warning: chdir(): No such file or directory (errno 2) in php shell code on line 1 PHP Stack trace: PHP 1. {main}() php shell code:0 PHP 2. chdir() php shell code:1 Warning: chdir(): No such file or directory (errno 2) in php shell code on line 1 Call Stack: 8.4448 62776 1. {main}() php shell code:0 8.4448 62888 2. chdir() php shell code:1 bool(false) Expected result: ---------------- Returns TRUE on success or FALSE and a PHP error of level E_WARNING on failure. You can suppress the error output of chdir() by prepending '@' to the front of the function name. This is a rough adjusted rip from "opendir()" return value description. Actual result: -------------- -/- ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54663&edit=1

« previous php.doc.bugs (#6766) next »