php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69390 ftp_chdir(null,'xxx') returns null
Submitted: 2015-04-07 01:39 UTC Modified: 2015-04-07 13:10 UTC
From: yk0242 at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Windows 7
Private report: No CVE-ID: None
 [2015-04-07 01:39 UTC] yk0242 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.ftp-chdir
---

The manual currently reads:

Return Values
Returns TRUE on success or FALSE on failure. 

However, if the resource $ftp_stream passed to ftp_chdir is null, the return value is neither TRUE or FALSE, but is null. 

Is this a behavioural problem, or should this be added to the documentation for clarity?

(our version is currently PHP Version 5.2.17, and cannot update for a while from internal reasons...)

Test script:
---------------
var_dump(ftp_chdir(null,".")); //outputs null (and a PHP warning)

Expected result:
----------------
boolean false

Actual result:
--------------
null

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-07 13:10 UTC] cmb@php.net
-Status: Open +Status: Not a bug
 [2015-04-07 13:10 UTC] cmb@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

That behavior is documented in the manual[1]:

| If the parameters given to a function are not what it expects,
| such as passing an array where a string is expected, the return
| value of the function is undefined. In this case it will likely
| return NULL but this is just a convention, and cannot be relied
| upon.

[1] <http://php.net/manual/en/functions.internal.php>
 [2015-04-08 03:08 UTC] yk0242 at gmail dot com
I understand now that although the NULL return is not documented per function, it is documented in the given page for internal functions in general. 
Thank you for your clarification.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC