Re: Re: Tiny pathinfo() patch
| From: | Tobias Schlitt | Date: | Fri, 14 Jul 2006 20:20:27 +0000 |
| Subject: | Re: Re: Tiny pathinfo() patch | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-24382@lists.php.net to get a copy of this message | ||
On 07/14/2006 10:09 PM Christian Schneider wrote:
> Tobias Schlitt wrote:
>> using string manipulation, I now patched pathinfo() to provide the
>> filename without extension per default with key "filename".
>>
>> Find the patch here:
>> http://schlitt.info/misc/pathinfo.patch
> If the patch is considered then I would propose to also return the key
> "filename" if the filename does not have a suffix. The current code
> seems to only return it if it can find a '.' in the filename.
>
> I.e. change
> if (p) {
> idx = p - ret;
> add_assoc_stringl(tmp, "filename", ret, idx, 1);
> }
>
> to
> idx = p ? (p - ret) : ret_len;
> add_assoc_stringl(tmp, "filename", ret, idx, 1);
> or something like that.
Valid point. I updated the patch.
Have a nice weekend!
Toby
--
Tobias Schlitt - Zend Certified Engineer GPG Key: 0xC462BC14
a passion for php http://www.schlitt.info
Like to say "thank you"? - http://pear.php.net/wishlist.php/toby