php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80993 readlink() works no correctly
Submitted: 2021-04-27 09:14 UTC Modified: 2021-04-27 13:08 UTC
Votes:3
Avg. Score:3.3 ± 1.7
Reproduced:2 of 3 (66.7%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: romanmartinuk at gmail dot com Assigned: cmb (profile)
Status: Wont fix Package: Filesystem function related
PHP Version: 7.3.27 OS: Windows 10.0.19042
Private report: No CVE-ID: None
 [2021-04-27 09:14 UTC] romanmartinuk at gmail dot com
Description:
------------
see table for all version PHP (8.0.3 - 7.1.3)

https://github.com/symfony/symfony/pull/40866#issuecomment-823991452



Test script:
---------------
<?php

$dir = __DIR__ . DIRECTORY_SEPARATOR . 'dir';
mkdir($dir);

$file = $dir . DIRECTORY_SEPARATOR . 'file';
$link1 = $dir . DIRECTORY_SEPARATOR . 'link1';
$link2 = $dir . DIRECTORY_SEPARATOR . 'link2';

touch($file);

symlink($file, $link1);
symlink($link1, $link2);

echo 'PHP=' . PHP_VERSION . ', realpath=' . basename(realpath($link2)) . ', readlink=' . basename(readlink($link2)) ;

unlink($file);
unlink($link1);
unlink($link2);
rmdir($dir);


Expected result:
----------------
PHP=7.3.27, realpath=file, readlink=link1

Actual result:
--------------
PHP=7.3.27, realpath=file, readlink=file

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-27 13:08 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-04-27 13:08 UTC] cmb@php.net
The erroneous readlink() has apparently been fixed inadvertently
when php_sys_readlink() has been refactored[1].

Anyhow, PHP 7.3 is in security mode[2], so unless this would be
regarded as security issue, the fix will not be backported.

[1] <https://github.com/php/php-src/commit/91c905e83c338ef66da824be4f90c1d78d134507>
[2] <https://www.php.net/supported-versions.php>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 08:01:26 2024 UTC