php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68823 Useles check
Submitted: 2015-01-13 05:12 UTC Modified: 2018-08-05 04:00 UTC
From: bugreports at internot dot info Assigned: carusogabriel (profile)
Status: Closed Package: *General Issues
PHP Version: master-Git-2015-01-13 (Git) OS: Linux Ubuntu 14.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugreports at internot dot info
New email:
PHP Version: OS:

 

 [2015-01-13 05:12 UTC] bugreports at internot dot info
Description:
------------
Hi,

In /main/php_open_temporary_file.c:

247#ifdef P_tmpdir
248        /* Use the standard default temporary directory. */
249        if (P_tmpdir) {
250                temporary_directory = strdup(P_tmpdir);
251                return temporary_directory;
252        }
253#endif


249        if (P_tmpdir) {
is useless due to 2 reasons:
1. it's an array, and cannot be NULL.
2. the check at line 247 should be fine as it is.


Thanks,



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-13 19:15 UTC] phpmpan at mpan dot pl
`P_tmpdir` has type `char*`: <https://www.gnu.org/software/libc/manual/html_node/Temporary-Files.html>.
 [2018-08-05 04:00 UTC] carusogabriel@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: carusogabriel
 [2018-08-05 04:00 UTC] carusogabriel@php.net
Closing as phpmpan said, it has the `char *` type and can be null: `P_tmpdir` has type `char*`: <https://www.gnu.org/software/libc/manual/html_node/Temporary-Files.html>.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 05:01:36 2025 UTC