php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12092 pathinfo fails to return when passed a file with no extension
Submitted: 2001-07-12 06:15 UTC Modified: 2001-07-12 11:10 UTC
From: aidan at reality dot co dot uk Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.4pl1 OS: GNU/Linux
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: aidan at reality dot co dot uk
New email:
PHP Version: OS:

 

 [2001-07-12 06:15 UTC] aidan at reality dot co dot uk
<? 
$info = pathinfo("/foo/bar");
echo ($info["dirname"]."<br>\n");
echo ($info["basename"]."<br>\n");
echo ($info["extension"]."<br>\n");
?>

This should print:
/foo<br>
bar<br>
<br>

but will not return.

<?
$info = pathinfo("/foo/bar.baz");
echo ($info["dirname"]."<br>\n");
echo ($info["basename"]."<br>\n");
echo ($info["extension"]."<br>\n");
?>

prints<?
$info = pathinfo("/foo/bar.");
echo ($info["dirname"]."<br>\n");
echo ($info["basename"]."<br>\n");
echo ($info["extension"]."<br>\n");
?>
/foo<br>
bar.baz<br>
baz<br>

as expected and

<?
$info = pathinfo("/foo/bar.");
echo ($info["dirname"]."<br>\n");
echo ($info["basename"]."<br>\n");
echo ($info["extension"]."<br>\n");
?>

prints
/foo<br>
bar.<br>
<br>

as expected, it's only the case where there is no trailing . that pathinfo fails to work.

The configure line is:

 './configure' '--with-config-file-path=/www/conf' '--enable-track-vars' '--with-apxs=/usr/apache/bin/apxs' '--with-oci8' '--enable-ftp' '--with-mysql' '--with-pgsql' '--enable-xml' '--enable-inline-optimization' '--disable-debug' '--with-zlib' '--enable-shared' '--with-gnu-ld' '--with-mcrypt'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-12 06:30 UTC] joey@php.net
Try upgrading your PHP. I get your "expected behavior"
from 4.0.7-dev.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 11 08:01:28 2025 UTC