DS removed?

For Joomla! 2.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
User avatar
starijiodvatre
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Mon Jun 02, 2008 11:32 am

DS removed?

Post by starijiodvatre » Mon Jan 16, 2012 5:51 pm

Does anybody know why is DS constant removed from the platform, and used DIRECTORY_SEPARATORE instead?

And BTW, where can information like this be found? I've searched everywhere.

User avatar
fmmarzoa
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 123
Joined: Sun Nov 11, 2007 1:15 pm
Location: Spain
Contact:

Re: DS removed?

Post by fmmarzoa » Mon Jan 16, 2012 11:09 pm

Which version are you talking about? On my devel J1.7 site I didn't notice such thing...
“The media's the most powerful entity on earth. They have the power to make the innocent guilty and to make the guilty innocent, and that's power. Because they control the minds of the masses.” -- Malcolm X

User avatar
starijiodvatre
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Mon Jun 02, 2008 11:32 am

Re: DS removed?

Post by starijiodvatre » Tue Jan 17, 2012 1:00 am

I've seen this on github, e.g: https://github.com/joomla/joomla-platfo ... 8a6d51c3ee

I couldn't find any info about this. Sorry if this is not the right forum, I haven't found better, either.

Pocketss
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 105
Joined: Thu Aug 27, 2009 3:07 am
Location: Troy, MI - USA

Re: DS removed?

Post by Pocketss » Tue Jan 17, 2012 5:09 am

It has been deprecate for a while. Not sure when that happened. Since Php handles '/' correctly on all OS no need for a constant.

Edit: you can usually find things like this by going thru the source code and/or using an IDE that can process phpdoc blocks.

User avatar
starijiodvatre
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Mon Jun 02, 2008 11:32 am

Re: DS removed?

Post by starijiodvatre » Tue Jan 17, 2012 11:02 am

Thank you for your reply, Pocketss.

I usually do find info about stuff like this, but there's nothing about removing DS in phpdoc.

Thank you, once again. ;)

alwarren
Joomla! Guru
Joomla! Guru
Posts: 527
Joined: Fri Aug 19, 2005 9:27 am

Re: DS removed?

Post by alwarren » Wed Feb 01, 2012 4:07 pm

Pocketss wrote:It has been deprecate for a while. Not sure when that happened. Since Php handles '/' correctly on all OS no need for a constant.

Edit: you can usually find things like this by going thru the source code and/or using an IDE that can process phpdoc blocks.
Been awhile since I tested it but there were some php file operations that broke without the proper directory separator. I'll have to do some poking and testing to see if the problems still exist.

If you have code that uses DS, you can always do something like this:

Code: Select all

if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
Al Warren
This ain't my first rodeo. Red Foreman says it best.
CQDX de WR5AW

User avatar
starijiodvatre
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Mon Jun 02, 2008 11:32 am

Re: DS removed?

Post by starijiodvatre » Thu Feb 02, 2012 10:25 am

Thanks alwarren.

This is what bugs me about Joomla! platform. Why they made a change like this one?! So many backward incompatibilities...

alwarren
Joomla! Guru
Joomla! Guru
Posts: 527
Joined: Fri Aug 19, 2005 9:27 am

Re: DS removed?

Post by alwarren » Sat Feb 04, 2012 1:08 pm

It seems to be back. Top of index.php in 2.5.1
Al Warren
This ain't my first rodeo. Red Foreman says it best.
CQDX de WR5AW

RedEye
Joomla! Ace
Joomla! Ace
Posts: 1460
Joined: Sat Jan 21, 2006 8:42 pm

Re: DS removed?

Post by RedEye » Sat Feb 04, 2012 7:29 pm

alwarren wrote:It seems to be back. Top of index.php in 2.5.1
Was always there and I guess it`s there in 2.5 because of backward compatibility

User avatar
starijiodvatre
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Mon Jun 02, 2008 11:32 am

Re: DS removed?

Post by starijiodvatre » Sat Feb 04, 2012 8:25 pm

RedEye, could you please click the link I've posted earlier in this thread?
Was always there but it won't be, and that's what this thread is all about, broken backward compatibility...

realityking
Joomla! Explorer
Joomla! Explorer
Posts: 428
Joined: Fri May 21, 2010 11:43 am
Location: Aachen, Germany
Contact:

Re: DS removed?

Post by realityking » Sun Feb 12, 2012 5:27 pm

The DS constant has been considered deprecated since Joomla 1.6. It's only needed in very rare circumstances and the real PHP constant DIRECTORY_SEPARATOR can be used.

This should have been marked in the source code, unfortunately in the 1.6 days this wasn't always done. The platform has a much better process for this.

Yes this is a backward compatible break, but you have plenty of time to adapt. Those following the dev mailing lists could have seen it back in the 1.6 days but even now it's still 7 months to remove DS from you core. Most likely we will also have a first alpha release in one to two months so extension developers can makes use their code continuous to work.

Joomla 3.0 (and Joomla Platform 12.1) are going to break backwards compatibility in a number of places. A huge amount of deprecated code has been removed (I'm certain more's to follow but the biggest chunk should be done) also the separation of platform and CMS may bring some minor issues with it (like changed file locations for starters). I started documenting those changes here: http://docs.joomla.org/Potential_backwa ... tform_12.1

I suggest all extension developers spend the time NOW to get off those APIs that are already removed in the current platform. I'm doing the same with the CMS and so far I've encountered no problem that couldn't be handled in the 2.5 series.

Most important change to extension devs is that the 1.5 style XML installation files will be no longer supported. Get off those as soon as you can, maybe after support for 1.5 is dropped in April would be a good time.

alwarren
Joomla! Guru
Joomla! Guru
Posts: 527
Joined: Fri Aug 19, 2005 9:27 am

Re: DS removed?

Post by alwarren » Tue Feb 14, 2012 11:41 am

realityking wrote:The DS constant has been considered deprecated since Joomla 1.6. It's only needed in very rare circumstances
True enough DS is only used 16 times. And it's easy enough to refactor an extension to either add DS or use DIRECTORY_SEPARATOR. But we shouldn't overlook the fact that even though the path separator shouldn't be an issue, there are still PHP extensions that require a well formed path with the proper separator. Those of us who have been there and done that will understand why that's important.

When in doubt, you can always use JPath::clean(). It's used 71 times in the core. I'm guessing there's a reason for that.
Al Warren
This ain't my first rodeo. Red Foreman says it best.
CQDX de WR5AW

realityking
Joomla! Explorer
Joomla! Explorer
Posts: 428
Joined: Fri May 21, 2010 11:43 am
Location: Aachen, Germany
Contact:

Re: DS removed?

Post by realityking » Tue Feb 14, 2012 12:47 pm

alwarren wrote: True enough DS is only used 16 times.
In 2.5.2 it won't be used at all :) Patch landed a couple of days ago.
alwarren wrote:When in doubt, you can always use JPath::clean(). It's used 71 times in the core. I'm guessing there's a reason for that.
That's mostly needed for comparing paths. The reason we did the whole exercise is speed BTW, back in the 1.6 development someone did some benchmarks and there's a small but measurable improvement due to less string concatenation.

alwarren
Joomla! Guru
Joomla! Guru
Posts: 527
Joined: Fri Aug 19, 2005 9:27 am

Re: DS removed?

Post by alwarren » Tue Feb 14, 2012 6:37 pm

realityking wrote:...That's mostly needed for comparing paths. The reason we did the whole exercise is speed BTW, back in the 1.6 development someone did some benchmarks and there's a small but measurable improvement due to less string concatenation.
Hey, what can I say. All I know is I have spent hours fleshing out that "very rare" issue of an improper path separator breaking something. And, by the way, it had nothing to do with comparing paths (or PHP versions). It actually predates the 1.6 days. Considerably. There was a very specific reason for doing it. It solved those "very rare" circumstances where things broke. I don't know how or when the code made it into the core. But if it was introduced solely for performance reasons or for comparing paths then the end result of preventing other breakage was quite coincidental.
Al Warren
This ain't my first rodeo. Red Foreman says it best.
CQDX de WR5AW


Locked

Return to “Joomla! 2.5 Coding”