php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46454 rmdir() on non-existent directory has different Warning wording than test
Submitted: 2008-11-01 16:17 UTC Modified: 2008-11-05 05:47 UTC
From: hostmaster at uuism dot net Assigned:
Status: Closed Package: Directory function related
PHP Version: 5.2CVS-2008-11-01 (snap) OS: Fedora Core 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hostmaster at uuism dot net
New email:
PHP Version: OS:

 

 [2008-11-01 16:17 UTC] hostmaster at uuism dot net
Description:
------------
rmdir() on non-existent directory produces the response "Warning: rmdir(temp): Not a directory" that is different than test script mkdir_rmdir_error.phpt expects: "Warning: rmdir(temp): No such file or directory"

This is the last statement in the test script.

Jim


Reproduce code:
---------------
<?php
/*  Prototype: bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context]]] );
    Description: Makes directory

    Prototype: bool rmdir ( string $dirname [, resource $context] );
    Description: Removes directory
*/

echo "*** Testing mkdir(): error conditions ***\n";
var_dump( mkdir() );  // args < expected
var_dump( mkdir(1, 2, 3, 4, 5) );  // args > expected
var_dump( mkdir("testdir", 0777, false, $context, "test") );  // args > expected

echo "\n*** Testing rmdir(): error conditions ***\n";
var_dump( rmdir() );  // args < expected
var_dump( rmdir(1, 2, 3) );  // args > expected
var_dump( rmdir("testdir", $context, "test") );  // args > expected

echo "\n*** Testing rmdir() on non-existent directory ***\n";
var_dump( rmdir("temp") );

echo "Done\n";
?>


Expected result:
----------------
*** Testing mkdir(): error conditions ***

Warning: mkdir() expects at least 1 parameter, 0 given in %s on line %d
bool(false)

Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d
bool(false)

Notice: Undefined variable: context in %s on line %d

Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d
bool(false)

*** Testing rmdir(): error conditions ***

Warning: rmdir() expects at least 1 parameter, 0 given in %s on line %d
bool(false)

Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d
bool(false)

Notice: Undefined variable: context in %s on line %d

Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d
bool(false)

*** Testing rmdir() on non-existent directory ***

Warning: rmdir(temp): No such file or directory in %s on line %d
bool(false)
Done


Actual result:
--------------
*** Testing mkdir(): error conditions ***

Warning: mkdir() expects at least 1 parameter, 0 given in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 10
bool(false)

Warning: mkdir() expects at most 4 parameters, 5 given in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 11
bool(false)

Notice: Undefined variable: context in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 12

Warning: mkdir() expects at most 4 parameters, 5 given in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 12
bool(false)

*** Testing rmdir(): error conditions ***

Warning: rmdir() expects at least 1 parameter, 0 given in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 15
bool(false)

Warning: rmdir() expects at most 2 parameters, 3 given in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 16
bool(false)

Notice: Undefined variable: context in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 17

Warning: rmdir() expects at most 2 parameters, 3 given in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 17
bool(false)

*** Testing rmdir() on non-existent directory ***

Warning: rmdir(temp): Not a directory in /usr/local/src/php5.2-200810312330/ext/standard/tests/file/mkdir_rmdir_error.php on line 20
bool(false)
Done


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-01 20:43 UTC] jani@php.net
What's the bug here? A test not passing for you or what? FYI, it does 
not fail for me on Fedora 8..
 [2008-11-01 21:15 UTC] hostmaster at uuism dot net
Jani,

Yes, the test is failing.  I get slightly different wording for the Warning than is expected by the test.  It's only a bug in the test script, not a bug in PHP.

Is the non-existent directory Warning produced by the operating system and just passed along by PHP?  That would explain why the test results fail for different operating systems.

Thanks for being patient with my inexperienced bug reports.

Jim
 [2008-11-05 05:47 UTC] hostmaster at uuism dot net
the test passed with php5.2-200811022130, so i assume that you fixed the problem.

thanks

jim
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 17 20:03:37 2021 UTC