Skip to content

Misleading note about move_uploaded_file() open_basedir awareness #11138

Closed

Description

@tmsholy

The manual page: https://php.net/function.move-uploaded-file contains a note which states:

move_uploaded_file() is open_basedir aware. However, restrictions are placed only on the to path

While this is true, if the from path is not in open_basedir, the file is moved, but it generates a warning in the error log:

PHP Warning: move_uploaded_file(): open_basedir restriction in effect. File(/tmp/phpBxHkjL) is not within the allowed path(s): (/var/www/uploads/)

Tested on PHP 8.2.5

Activity

  1. damianwadley commented on Apr 26, 2023

    @damianwadley
    Member

    This shouldn't be a documentation issue: open_basedir is to prevent access to unauthorized files, but PHP accounts for that during move_uploaded_file by checking the source was an uploaded file.

  2. transferred this issue fromphp/doc-enon Apr 26, 2023
  3. added 2 commits that reference this issue on Apr 28, 2023
    5edbc6d
    8bf2d58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions