php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55101 Reflection tries to find symlink() and readlink() when they don't exist
Submitted: 2011-07-01 08:51 UTC Modified: 2011-08-30 14:18 UTC
From: vrana@php.net Assigned: pajoye
Status: Assigned Package: Reflection related
PHP Version: 5.4.0alpha1 OS: Windows XP
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-07-01 08:51 UTC] vrana@php.net
Description:
------------
These two functions are available on Windows >= Vista since PHP 5.3.0. The problem is that reflection have some pointers on them even in Windows < Vista (e.g. XP) where they are not available.


Test script:
---------------
<?php
$r = new ReflectionExtension("standard");
$r->getFunctions();
?>


Expected result:
----------------
bool(false)


Actual result:
--------------
bool(false)

Warning: ReflectionExtension::getFunctions(): Internal error: Cannot find extension function readlink in global function table

Warning: ReflectionExtension::getFunctions(): Internal error: Cannot find extension function symlink in global function table


Patches

disable-functions.patch (last revision 2011-08-30 13:13 UTC) by bjori@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-01 08:54 UTC] vrana@php.net
The first line of Test script should be:

var_dump(function_exists('readlink'));

It outputs bool(false) mentioned in the result.
 [2011-07-01 09:03 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2011-07-01 09:03 UTC] pajoye@php.net
They are only available in vista and later.
 [2011-07-01 09:04 UTC] pajoye@php.net
They are also dynamically available, we remove them at init time if the Windows 
version is < vista.
 [2011-07-01 09:06 UTC] pajoye@php.net
-Status: Bogus +Status: Open
 [2011-07-01 09:06 UTC] pajoye@php.net
re-open, but really not sure if it is fixable in reflexion, but there is no bug in 
these functions per se :)
 [2011-07-01 09:07 UTC] vrana@php.net
-Summary: Functions symlink() and readlink() are missing on Windows < Vista +Summary: Reflection tries to find symlink() and readlink() when they don't exist
 [2011-07-01 09:07 UTC] vrana@php.net
I know, it is even mentioned in the bug report. The problem is that Reflection doesn't know it and produces an Internal error.
 [2011-07-01 09:19 UTC] pajoye@php.net
It certainly does something nasty, can you try to figure out where pls?
 [2011-07-01 09:40 UTC] vrana@php.net
I've looked in the source codes but I didn't get a clue how is it achieved that readlink() is disabled on Windows < Vista.

I also don't see anything related at http://lxr.php.net/search?project=PHP_5_4&refs=readlink
 [2011-07-01 18:43 UTC] felipe@php.net
This specific windows disabling stuff is done at http://lxr.php.net/xref/PHP_5_4/main/main.c#php_win32_disable_functions but I think it might be handled like we treat the disable_functions INI entry at http://lxr.php.net/xref/PHP_5_4/Zend/zend_API.c#disabled_function
 [2011-08-30 13:13 UTC] bjori@php.net
The following patch has been added/updated:

Patch Name: disable-functions.patch
Revision:   1314710033
URL:        https://bugs.php.net/patch-display.php?bug=55101&patch=disable-functions.patch&revision=1314710033
 [2011-08-30 14:18 UTC] bjori@php.net
-Assigned To: +Assigned To: pajoye
 [2011-08-30 14:18 UTC] bjori@php.net
I don't have a Windows build environment.. but I believe the attached patch fixes 
this issue, and makes more sense :]

Could you verify it for me Pierre?
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC