Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: PHP 7.3.5 and 7.4.1 windows folder name ending with period not working #14858

Closed
naumanjkhan opened this issue Feb 18, 2020 · 10 comments · Fixed by #14860
Closed

[BUG]: PHP 7.3.5 and 7.4.1 windows folder name ending with period not working #14858

naumanjkhan opened this issue Feb 18, 2020 · 10 comments · Fixed by #14860
Assignees
Labels
bug A bug report status: low Low

Comments

@naumanjkhan
Copy link

naumanjkhan commented Feb 18, 2020

Warning: mkdir(): Permission denied

https://github.com/phalcon/cphalcon/blob/4.0.x/phalcon/Helper/Str.zep#L210

cache file name has dots in it, e.g; index.12321321.cache.html

$dir = 'index.12321321.cache.html';
$cache = new Phalcon\Cache($adapter);
$cache->set($dir, 'hello world', 30);
// phalcon/Helper/Str::dirFromFile(string! file)
// mkdir(directory, 0777, true);

Details

  • Phalcon version: 4.0.3 & 4.0.4
  • PHP Version: 7.4.1
  • Operating System: Windows 10
@Jeckerson
Copy link
Member

Jeckerson commented Feb 19, 2020

Can you try with $recursive = true ?

mkdir($dir, null, true);

Jeckerson added a commit that referenced this issue Feb 19, 2020
@Jeckerson Jeckerson self-assigned this Feb 19, 2020
@naumanjkhan
Copy link
Author

@Jeckerson https://github.com/phalcon/cphalcon/blob/4.0.x/phalcon/Storage/Adapter/Stream.zep#L277

if !is_dir(directory) {
  mkdir(directory, 0777, true);
}

@ruudboon
Copy link
Member

Are you on Phalcon 4.0.4?

@naumanjkhan
Copy link
Author

@ruudboon 4.0.3

@naumanjkhan
Copy link
Author

Updated to 4.0.4 and problem persists

@ruudboon
Copy link
Member

Thnx for testing on the upgrade. I did some fixes in 4.0.1 related in this area so wanted to be sure you’re not on 4.0.0.
I think @Jeckerson is on it.

Jeckerson added a commit that referenced this issue Feb 25, 2020
Jeckerson added a commit that referenced this issue Feb 25, 2020
Jeckerson added a commit that referenced this issue Feb 25, 2020
ruudboon added a commit that referenced this issue Feb 25, 2020
@Jeckerson
Copy link
Member

Jeckerson commented Feb 25, 2020

After tests in all 3 envs (Linux and Mac) via integration tests. Meanwhile Windows tests I did manually.
So the problem is in Windows (partially) and in PHP mainly.

In Windows, if you try to create folder with dot at the end, it will remove it and create without it.
2020-02-25_14-32-07

Same thing if create via cmd and mkir command.

Meanwhile in PHP it will output error and do not create an folder:

PHP Warning:  mkdir(): Permission denied

Probably make sense to report bug to PHP...

@naumanjkhan Any way, in your case, just replace . dots with - in filename and it will work.

/cc @phalcon/core-team Suggestions what to do from our side.

@Jeckerson Jeckerson added status: low Low and removed status: unverified Unverified labels Feb 25, 2020
@Jeckerson Jeckerson linked a pull request Feb 25, 2020 that will close this issue
5 tasks
@naumanjkhan
Copy link
Author

naumanjkhan commented Feb 26, 2020

@Jeckerson thank you for suggestion but that is what I have already done, changed the file name. But I will have to remember it and will have to replace wherever I am using the filename with dots for cache.

Wouldn't it be possible if it is handled internally and developers don't have to remember about replacing dots on windows environment (an extra burden)?

@niden
Copy link
Member

niden commented Feb 26, 2020

@Jeckerson I think the best approach on this would be to replace the . with - when we create the subfolders and handle it internally.

niden added a commit that referenced this issue Mar 5, 2020
niden added a commit that referenced this issue Mar 5, 2020
niden added a commit that referenced this issue Mar 5, 2020
@niden
Copy link
Member

niden commented Mar 5, 2020

Resolved in #14893

Thank you @naumanjkhan

@niden niden closed this as completed Mar 5, 2020
niden added a commit that referenced this issue Mar 7, 2020
* 4.0.x: (116 commits)
  Regenerating ext again
  Updated changelog for PECL
  Updated optimized build files
  Generating ext folder
  Updated version for release
  [#14858] - PHPCS
  [#14858] - Corrected and added more tests
  [#14858] - Updated changelog
  [#14858] - Moved models to check outside the models folder to avoid collisions
  [#14858] - Fixed test
  [#14858] - Fixed dirFromFile to remove "." for Windows
  add backer (github)
  Update changelog [skip ci]
  Update tests schemas
  Add condition to add 'default NULL' with 'ON UPDATE'
  Fix query
  Add test case with 'default null on update'
  Remove Products model
  Move setDatabase() inside mvcModelCriteriaJoinManyToManyMultipleSchema() method
  Remove duplicate setDatabase() method
  ...
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants