{"action":"created","issue":{"url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/580","repository_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache","labels_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/580/labels{/name}","comments_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/580/comments","events_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/580/events","html_url":"https://github.com/PHPSocialNetwork/phpfastcache/issues/580","id":303484873,"number":580,"title":"Directory::getAbsolutePath() returns incorrect path","user":{"login":"mzdr","id":3847901,"avatar_url":"https://avatars0.githubusercontent.com/u/3847901?v=4","gravatar_id":"","url":"https://api.github.com/users/mzdr","html_url":"https://github.com/mzdr","followers_url":"https://api.github.com/users/mzdr/followers","following_url":"https://api.github.com/users/mzdr/following{/other_user}","gists_url":"https://api.github.com/users/mzdr/gists{/gist_id}","starred_url":"https://api.github.com/users/mzdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzdr/subscriptions","organizations_url":"https://api.github.com/users/mzdr/orgs","repos_url":"https://api.github.com/users/mzdr/repos","events_url":"https://api.github.com/users/mzdr/events{/privacy}","received_events_url":"https://api.github.com/users/mzdr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-08T13:47:27Z","updated_at":"2018-03-08T23:29:18Z","closed_at":null,"author_association":"NONE","body":"### Configuration:\r\n\r\nPhpFastCache version: `6.1.1`\r\nPHP version: `7.1.14`\r\nOperating system: `Mac OS X 10.13.3 (17D47)`\r\n\r\n#### Issue description:\r\n\r\nUsing `path` with `files` driver _always_ returns an absolute path. Steps to reproduce:\r\n\r\n1. `composer require phpFastCache/phpFastCache`\r\n2. `mkdir cache`\r\n3. `chmod 777 cache`\r\n4. `touch index.php`\r\n5. Paste into `index.php`:\r\n\r\n```php\r\n<?php\r\n\r\nrequire __DIR__ . '/vendor/autoload.php';\r\n\r\nuse phpFastCache\\CacheManager;\r\n\r\nCacheManager::getInstance('files', ['path' => './cache']);\r\n```\r\n\r\nNow if I open the index.php with my local webserver, I get an exception saying:\r\n\r\n`Fatal error: Uncaught phpFastCache\\Exceptions\\phpFastCacheIOException: Path \"/cache/Auto/Files\" is not writable, please set a chmod 0777 or any writable permission and make sure to make use of an absolute path ! Additional information provided by error_get_last(): mkdir(): Permission denied`\r\n\r\nThis is because it tries to write to `/cache/…` instead of `./cache`. \r\n\r\nIs this on purpose? Becaue `phpFastCache/Util/Directory::getAbsolutePath()` shall return an absolute path but doesn’t consider the actual filesystem.\r\n\r\nIf relative paths are considered to be a bad pattern, would you mind to explain why?\r\n\r\nThanks! "},"comment":{"url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/comments/371660896","html_url":"https://github.com/PHPSocialNetwork/phpfastcache/issues/580#issuecomment-371660896","issue_url":"https://api.github.com/repos/PHPSocialNetwork/phpfastcache/issues/580","id":371660896,"user":{"login":"mzdr","id":3847901,"avatar_url":"https://avatars0.githubusercontent.com/u/3847901?v=4","gravatar_id":"","url":"https://api.github.com/users/mzdr","html_url":"https://github.com/mzdr","followers_url":"https://api.github.com/users/mzdr/followers","following_url":"https://api.github.com/users/mzdr/following{/other_user}","gists_url":"https://api.github.com/users/mzdr/gists{/gist_id}","starred_url":"https://api.github.com/users/mzdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzdr/subscriptions","organizations_url":"https://api.github.com/users/mzdr/orgs","repos_url":"https://api.github.com/users/mzdr/repos","events_url":"https://api.github.com/users/mzdr/events{/privacy}","received_events_url":"https://api.github.com/users/mzdr/received_events","type":"User","site_admin":false},"created_at":"2018-03-08T23:29:18Z","updated_at":"2018-03-08T23:29:18Z","author_association":"NONE","body":"I see. Can you give me an example for the “possible chdir/getcwd differences between a WEB and CLI execution for a single application” you were talking about? I’m still not convinced why you should enforce an absolute path, especially if it’s related to a specific set of conditions.\r\n\r\nLet’s say I’m building a very simple web application and I have a single configuration file that will be shared among several other developers. Now how do I get around the problem of the absolute path? Sure you could say that I need some kind of setup routine, but this overhead would be introduced by your “restriction”.\r\n\r\nAre you totally against loosing up this rule/restriction? I think it’s the users responsibility to take care of path differences/incompatibilities within a single application among different types of execution."}}
{"actor":{"display_login":"mzdr"}}