php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #79071 Undocumented truncation of tempnam() second parameter
Submitted: 2020-01-06 14:11 UTC Modified: 2020-02-09 14:26 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: fabienung at hotmail dot fr Assigned: cmb (profile)
Status: Closed Package: Filesystem function related
PHP Version: 7.4.1 OS: Linux
Private report: No CVE-ID: None
 [2020-01-06 14:11 UTC] fabienung at hotmail dot fr
Description:
------------
tempnam() will truncate the second argument after 63 characters 

see: https://github.com/php/php-src/blob/bbcfa66e06110d8256595e644378a5358dda3558/ext/standard/file.c#L836-L839

introduced in commit : 
https://github.com/php/php-src/commit/4ca3df56d356ed8c3b55695ed588783e3f91378c

Test script:
---------------
var_dump(tempnam('/tmp', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbcdefghijklm'));

string(74) "/tmp/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbFkS7ld"

Expected result:
----------------
It should be documented, also maybe either do not truncate or warn if there is a truncation.

Actual result:
--------------
Silent truncation.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-06 14:41 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2020-01-06 14:41 UTC] cmb@php.net
Since this truncation happens as of PHP 5.1.3, in my opinion just
documenting the fact should be sufficient.
 [2020-02-09 14:25 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=349191
Log: Fix #79071: Undocumented truncation of tempnam() second parameter
 [2020-02-09 14:26 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-02-09 14:26 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-09 16:01 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=58d190bce3ee0db136502bd705e7d515ba9d9447
Log: Fix #79071: Undocumented truncation of tempnam() second parameter
 [2020-02-09 23:39 UTC] mumumu@php.net
Automatic comment from SVN on behalf of mumumu
Revision: http://svn.php.net/viewvc/?view=revision&revision=349192
Log: Fix #79071: Undocumented truncation of tempnam() second parameter
 [2020-02-10 14:20 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=aebb4478adb18c9629fdc89bba24efde92f7e7ff
Log: Fix #79071: Undocumented truncation of tempnam() second parameter
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri May 29 18:01:25 2020 UTC