On 20 Aug 2008, at 22:09, Stephen Johnson wrote:
I am debugging someone else’s code, and this is what they have :


1055    function mkdir_recursive($pathname, $mode)
1056    {
1057        is_dir(dirname($pathname)) ||
mkdir_recursive(dirname($pathname), $mode);
1058        return is_dir($pathname) || @mkdir($pathname, $mode);
1059    }

The part that bothers me is that mkdir_recursive calls itself from within
itself.

I am not an expert on this particular type of thing, and maybe that is
allowed, but it seems wrong to me, and this error is being generated:


Fatal error: Call to undefined function mkdir_recursive() in xxxxx.php on
line 1057

It's got "recursive" in its name so I'd be surprised if it didn't call itself. As for the error I don't really know since the code you've provided clearly defines that function on line 1055. As someone else has mentioned you might want to make sure that xxxxx.php is the same file that you've posted the snippet from.

If you're using PHP5 then you might be interested to know that the mkdir function supports recursive creation. Check http://php.net/mkdir for details.

-Stut

--
http://stut.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to