Doc #79071 [Opn->Ver]: Undocumented truncation of tempnam() second parameter

From: Date: Mon, 06 Jan 2020 14:41:50 +0000
Subject: Doc #79071 [Opn->Ver]: Undocumented truncation of tempnam() second parameter
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17184@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79071&edit=1

 ID:                 79071
 Updated by:         cmb@php.net
 Reported by:        fabienung at hotmail dot fr
 Summary:            Undocumented truncation of tempnam() second
                     parameter
-Status:             Open
+Status:             Verified
 Type:               Documentation Problem
 Package:            Filesystem function related
 Operating System:   Linux
 PHP Version:        7.4.1
 Block user comment: N
 Private report:     N

 New Comment:

Since this truncation happens as of PHP 5.1.3, in my opinion just
documenting the fact should be sufficient.


Previous Comments:
------------------------------------------------------------------------
[2020-01-06 14:11:30] 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.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79071&edit=1


Thread (3 messages)

« previous php.doc.bugs (#17184) next »