php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54663 chdir() emits E_WARNING
Submitted: 2011-05-04 20:32 UTC Modified: 2011-08-25 20:51 UTC
From: alex dot schuch at gmx dot de Assigned: nikic (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: -/-
Private report: No CVE-ID: None
 [2011-05-04 20:32 UTC] 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:
--------------
-/-

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-30 01:07 UTC] philip@php.net
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
 [2011-08-25 20:49 UTC] nikic@php.net
Automatic comment from SVN on behalf of nikic
Revision: http://svn.php.net/viewvc/?view=revision&revision=315518
Log: Fix Doc Bug #54663: chdir() emits E_WARNING
 [2011-08-25 20:51 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2011-08-25 20:51 UTC] nikic@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Added a note in the errors section. (I didn't add the error suppression part as people tend to consider that bad practice.)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 11:00:02 2026 UTC