Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-11511

phpbb_is_writable() fails on symlinks on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • 3.0.15-RC1, 3.1.12-RC1
    • 3.0.11
    • Other
    • None
    • Windows 7, PHP 5.3.21, PHP 5.4.12

      Path resolution for symlinks on Windows in phpbb_is_writable() ends up with a case difference on the drive letter which causes it to return false.

      The case difference is caused by realpath() returning a lowercase version while tempnam() returns one with an uppercase. This only happens with symlinks, using a normal directory results in both functions returning the path with an uppercase.

      In the example below, cache2 is symlinked to ./cache which is writable.

      tempnam('./cache2/', 'i_w'): c:\wamp\www\phpBB3\cache\i_wA8BE.tmp
      phpbb_realpath('./cache2/'): c:\wamp\www\phpBB3\cache
      realpath('./cache2/'): c:\wamp\www\phpBB3\cache
      tempnam(phpbb_realpath('./cache2/'), 'i_w'): C:\wamp\www\phpBB3\cache\i_wA8CE.tmp
      var_dump(phpbb_is_writable('./cache2/')): boolean false

      Non-symlinked:

      tempnam('./cache/', 'i_w'): C:\wamp\www\phpBB3\cache\i_w4557.tmp
      phpbb_realpath('./cache/'): C:\wamp\www\phpBB3\cache
      realpath('./cache/'): C:\wamp\www\phpBB3\cache
      tempnam(phpbb_realpath('./cache/'), 'i_w'): C:\wamp\www\phpBB3\cache\i_w4558.tmp
      var_dump(phpbb_is_writable('./cache/')): boolean true

            CHItA CHItA
            Noxwizard Patrick Webster
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: