开发者

tempnam returning an extra path prefix

When we call

$tmpFilename = tempnam(SIEFREPOSITORY, 'Sief');

it returns

/export/sief/share开发者_如何学编程/htdocs/siefvalidator_prod/sieflog/SiefMVNtuW

SIEFREPOSITORY is

/share/htdocs/siefvalidator_prod/sieflog/SiefMVNtuW

why is it adding extra /export/sief prefix?


It would appear that the SIEFREPOSITORY path is not writable, does not exist or is otherwise unusable, in which case tempnam falls back to other paths, as explained in the documenation:

Creates a file with a unique filename, with access permission set to 0600, in the specified directory. If the directory does not exist, tempnam() may generate a file in the system's temporary directory, and return the name of that.

and

If PHP cannot create a file in the specified dir parameter, it falls back on the system default. On NTFS this also happens if the specified dir contains more than 65534 files.

Check if something's wrong with that path and have a look through the comments in the above linked site, there are some tidbits about gaining more control over tempnam.


It was because /share was symbolic linked to /export/sief/share and later versions of php returns absolute path from tempnam() which gave me the target of symbolic link [/export/...].

It caused problems for me as it was not in open_basedir.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜