0

I am currently using the following code in CakePHP 1.3.10 (using PHP 5.2.17) when mkdir returns false:

CakeLog::write('error', "An error occurred while creating the \"$target_dir\" directory.");

I would like to also capture the exact error message such as:

Warning (2): mkdir() [function.mkdir]: File exists

I could then include that error message in the log. How can I do that with CakePHP? I've tried using the error_get_last function, but it just says:

Non-static method Configure::getInstance() should not be called statically, assuming $this from incompatible context

Any help would be appreciated.

Nick
  • 8,049
  • 18
  • 63
  • 107

1 Answers1

1

You are actually trying to catch a warning. A method for that is answered here

The function file_exists() does check for directory existence too. You could try that possibly

Community
  • 1
  • 1
Leo
  • 1,521
  • 12
  • 18