php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52447 FAIL getlastmod() and others [ext/standard/tests/file/statpage.phpt]
Submitted: 2010-07-26 19:18 UTC Modified: 2021-08-01 04:22 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: glen at delfi dot ee Assigned: cmb (profile)
Status: No Feedback Package: Testing related
PHP Version: 5.3.3 OS: PLD Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-07-26 19:18 UTC] glen at delfi dot ee
Description:
------------
ext/standard/tests/file/statpage.phpt test fails, apparently because 
getmyinode() returns false, when the script is evaluated or feed from pipe, it 
so returns false:


$ php -r 'var_dump(getmyinode());'
bool(false)

$ echo '<?php var_dump(getmyinode());' | php
bool(false)

and i suppose this is how tests are run, because the test fails:

+ export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
+ unset TZ LANG LC_ALL
+ /usr/bin/make -j16 test EXTENSION_DIR=modules 
PHP_TEST_SHARED_SYSTEM_EXTENSIONS= RUN_TESTS_SETTINGS=-q --show-out --show-diff 
ext/standard/tests/file/statpage.phpt

Build complete.
Don't forget to run 'make test'.


=====================================================================
PHP         : /home/users/glen/rpm/BUILD.i686-linux/php-5.3.3/sapi/cli/php
PHP_SAPI    : cli
PHP_VERSION : 5.3.3
ZEND_VERSION: 2.3.0
PHP_OS      : Linux - Linux carme-pld-i686 2.6.34.1-3 #1 SMP Tue Jul 6 16:15:11 
CEST 2010 i686
INI actual  : /home/users/glen/rpm/BUILD.i686-linux/php-5.3.3/tmp-php.ini
More .INIs  :
CWD         : /home/users/glen/rpm/BUILD.i686-linux/php-5.3.3
Extra dirs  :
VALGRIND    : Not used
=====================================================================
Running selected tests.
TEST 1/1 [ext/standard/tests/file/statpage.phpt]
========OUT========
int(1280163890)
bool(false)
int(1009)
int(22286)
int(1000)
Done
========DONE========

========DIFF========
002+ bool(false)
005- int(%d)
========DONE========
FAIL getlastmod() and others [ext/standard/tests/file/statpage.phpt]
=====================================================================
Number of tests :    1                 1
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (100.0%) (100.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      :    0 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
getlastmod() and others [ext/standard/tests/file/statpage.phpt]
=====================================================================

$ cat ext/standard/tests/file/statpage.phpt
--TEST--
getlastmod() and others
--FILE--
<?php

var_dump(getlastmod());
var_dump(getmyinode());
var_dump(getmyuid());
var_dump(getmypid());
var_dump(getmygid());

echo "Done\n";
?>
--EXPECTF--
int(%d)
int(%i)
int(%d)
int(%d)
int(%d)
Done

so this test must be removed (at least getmyinode() from it), as it is 
impossible to test what inode is when script is ran from pipe, and it does not 
test anything useful.

also, i tried to find the script in svn, but no luck, it's only present in cvs?

http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/tests/file/
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/ext/standard/tests/file/
http://svn.php.net/viewvc/php/php-src/tags/php_5_3_3/ext/standard/tests/file/
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/statpage.phpt


i'd appreachiate of info how release tarballs are and where to get latest 
source, because snapshots from http://qa.php.net also contain the test file, not  
in svn web.

attached is patch which removes getmyinode() and it's result from test file

Expected result:
----------------
test things that are testable, remove bogus tests.


Patches

rm-myinode-and-getlastmod.patch (last revision 2010-07-26 17:22 UTC by glen at delfi dot ee)
rm-myinode.patch (last revision 2010-07-26 17:19 UTC by glen at delfi dot ee)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-26 19:22 UTC] glen at delfi dot ee
if you retry the test, you'll see that "var_dump(getlastmod());" result is 
growing, i.e it is actually timestamp of when the test was run, not anything 
actual to the test script that was run.

so another patch to remove getlastmod() call an result, leaving only irrelevant 
things to test, i.e as said earlier, the test is to be removed whatsoever
 [2011-09-26 23:05 UTC] tyrael@php.net
-Package: Filesystem function related +Package: Testing related
 [2021-07-19 11:28 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-19 11:28 UTC] cmb@php.net
The test passes for me, and also on CI; does it still fail for you
with any of the actively supported PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-08-01 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon May 16 10:05:46 2022 UTC