Hi all!
It occured several times in the past weeks, where I needed the filename
without extension as well as the file extension extracted from a
pathname. Since first calling pathinfo()
and then basename()
again, or
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
The patch is against 5_2.
Maybe someone considers that useful as well?
Regards,
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
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.
- Chris
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
Hello Tobias,
looks good after the update. Can you provide a patch for HEAD too?
also please provide patches with "cvs di -upd".
best regards
marcus
Friday, July 14, 2006, 9:30:48 PM, you wrote:
Hi all!
It occured several times in the past weeks, where I needed the filename
without extension as well as the file extension extracted from a
pathname. Since first callingpathinfo()
and thenbasename()
again, or
using string manipulation, I now patchedpathinfo()
to provide the
filename without extension per default with key "filename".
Find the patch here: http://schlitt.info/misc/pathinfo.patch
The patch is against 5_2.
Maybe someone considers that useful as well?
Regards,
TobyTobias 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
Best regards,
Marcus
I'm annoyed! Quite annoyed!!
Ok. I know none of you know me and I've not met any of you.
But, a while ago I submitted a relatively minor patch to extend PHP's
php.ini filename to include the major version. This was an extension
to the existing searching rules. As a windows user, I'm not in a
position to build my own executables. I wish I was!!!!
The patch would allow different versions of PHP to use the same SAPI
but with different php.ini files. e.g. originally just php.ini, then
php-cli.ini, php-cgi.ini, php-isapi.ini, etc.
My patch would extend this to ALSO allow php4-cli.ini, php5-cgi.ini,
php6-ispai.ini (just examples - all combinations allowed). And the
patch, whilst untested by me, would allow upto php V99. (I've been
with PHP since just into V4, and soon V6 will be here, so PHP V9
seemed too short sighted).
As this patch has REAL advantages for me and others wishing to use
PHP4 / 5 and 6 on the same machine, with the same webserver (Either
ISAPI OR CGI), I was surprised when it wasn't committed.
Now the patch provided by Tobias, for what is, from his own words,
completely possible in userland without any extension or enhancement
to php core, seems totally redundant.
Whilst I understand that you cannot have every patch supplied
incorporated into the source, would you please comment as to why my
patch was rejected?
Are there some more hoops I'm expected to jump through?
I know that there is a major focus on Unicode at the moment and this
is taking a lot of time. This is why I though actually supplying a
patch would be better received than simply a WIBNI approach.
My intention here is NOT to upset anyone, especially Tobias. He had a
problem and he fixed it and with the support of the core devlopers,
his solution has been incorporated into the core.
I have a different problem. I did the research and supplied a patch.
The patch has been rejected. I do not know why.
If there is more that I need to do to get this functioning, then a few
pointers would be nice.
Regards and true appreciation of the skills, hard work and dedication
of the efforts of the core php developers. I make my living standing
on your shoulders.
Richard Quadling.
P.S. I REALLY don't want to annoy anyone. Really.
Hello Tobias,
looks good after the update. Can you provide a patch for HEAD too?
also please provide patches with "cvs di -upd".
best regards
marcusFriday, July 14, 2006, 9:30:48 PM, you wrote:
Hi all!
It occured several times in the past weeks, where I needed the filename
without extension as well as the file extension extracted from a
pathname. Since first callingpathinfo()
and thenbasename()
again, or
using string manipulation, I now patchedpathinfo()
to provide the
filename without extension per default with key "filename".Find the patch here: http://schlitt.info/misc/pathinfo.patch
The patch is against 5_2.
Maybe someone considers that useful as well?
Regards,
Toby
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
Hello Richard,
Saturday, July 15, 2006, 2:15:15 PM, you wrote:
I'm annoyed! Quite annoyed!!
Ok. I know none of you know me and I've not met any of you.
But, a while ago I submitted a relatively minor patch to extend PHP's
php.ini filename to include the major version. This was an extension
to the existing searching rules. As a windows user, I'm not in a
position to build my own executables. I wish I was!!!!
Why not simply provide it again? Sometimes patches get lost just because
nobody felt responsible or saw a need for himself. In this particularcase
i am interested myslef, quite selfish, isn't it? And btw what does your
patch offer besides the configure options related to ini searching we
have already? And please do this in a new seperate thread.
Best regards,
Marcus
Hello Richard,
Saturday, July 15, 2006, 2:15:15 PM, you wrote:
I'm annoyed! Quite annoyed!!
Ok. I know none of you know me and I've not met any of you.
But, a while ago I submitted a relatively minor patch to extend PHP's
php.ini filename to include the major version. This was an extension
to the existing searching rules. As a windows user, I'm not in a
position to build my own executables. I wish I was!!!!Why not simply provide it again? Sometimes patches get lost just because
nobody felt responsible or saw a need for himself. In this particularcase
i am interested myslef, quite selfish, isn't it? And btw what does your
patch offer besides the configure options related to ini searching we
have already? And please do this in a new seperate thread.
The best way to do not lost a patch is to open a bug and leave a link to it.
--Pierre
On 07/15/2006 12:35 PM Marcus Boerger wrote:
Hello Tobias,
looks good after the update. Can you provide a patch for HEAD too?
also please provide patches with "cvs di -upd".
Done.
Find the patches here:
http://schlitt.info/misc/pathinfo-HEAD.patch
http://schlitt.info/misc/pathinfo-5_2.patch
Regards,
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