Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump PHP version to v5.4 #186

Closed
rugk opened this issue Feb 16, 2017 · 12 comments
Closed

Bump PHP version to v5.4 #186

rugk opened this issue Feb 16, 2017 · 12 comments

Comments

@rugk
Copy link
Member

rugk commented Feb 16, 2017

Continuing #48 what about requiring PHP >=5.4 (currently: 5.3). This would allow us to use <?=, which would make our templates much easier to read…

Just my two cents… Maybe there are other advantages.

@elrido
Copy link
Contributor

elrido commented Feb 17, 2017

You can use <?= since PHP 3 or 4, but its considered bad practice. It only saves a few bytes and is less clear to read.

Why artificially increase the version our software runs on?

@rugk
Copy link
Member Author

rugk commented Feb 17, 2017

You can use <?= since PHP 3 or 4

Ah, yeah, but only since v5.4 it "is always available regardless of the short_open_tag ini setting." (source). And as admins should rather have this setting disabled (because the real short open tags are bad practise and potentially confusing), we can only use this with PHP 5.4 or above…

but its considered bad practice. It only saves a few bytes and is less clear to read.

That it is bad practise is only your opinion. I've never read this anywhere else (and please don't confuse it with the real short opening tags, which are indeed bad practise - for technical reasons)…
Actually it makes the code easier to read because you do not need echo anymore so

<a href="<?= $link ?>"><?= $text ?></a>

is certainly easier to read than if this code would be blown up with echo every time you just need to echo some things…

@elrido
Copy link
Contributor

elrido commented Feb 17, 2017

This is not a personal opinion, Zend (the PHP developers) themselves do advise not to use these as far back as with ZF 1.12:
https://framework.zend.com/manual/1.12/en/zend.view.introduction.html#zend.view.introduction.shortTags

@rugk
Copy link
Member Author

rugk commented Feb 17, 2017

However, the default for the php.ini short_open_tag setting is typically off in production or on shared hosts -- making their use not terribly portable.

Okay, that's a good fact against them…
Long tags have likely better support…

@rugk rugk closed this as completed Feb 17, 2017
@rugk
Copy link
Member Author

rugk commented Feb 17, 2017

But I am stupid. Zend is wrong or outdated (I mean the doc you linked to is clearly outdated), as this whole thing was about PHP 5.4 or higher.

To quote myself:

Ah, yeah, but only since v5.4 it "is always available regardless of the short_open_tag ini setting."

So Zend's argument does not apply. If we use PHP >= 5.4 you can use <?= on every server. Here is a similar reply (from 2014). First the outdated information, followed by "This should mean they're safe to use in portable code but that does mean there's then a dependency on PHP 5.4+.". So well… we're only 0.1 versions away from this dependency, it would likely not hurt anyone.
Also we might have a look what else we could sue with PHP 5.4.

Any counterargument against requiring PHP 5.4 and using the nice short tags?

@rugk rugk reopened this Feb 17, 2017
@rugk
Copy link
Member Author

rugk commented Feb 17, 2017

Other features from this release announcement I'd like to use:

  • short array syntax: [1, 2, 3] is so much betterarray(…)
  • don't know whether the file upload progress could be useful for us…

@elrido
Copy link
Contributor

elrido commented Feb 22, 2017

Here are some (more) arguments for going PHP 5.4 as a minimum:

@rugk
Copy link
Member Author

rugk commented Mar 5, 2017

So now we can change <?php echo $bar ?> to <?= $bar ?>

@elrido
Copy link
Contributor

elrido commented Mar 5, 2017

If it bothers you so much, do it. I personally would not change working code into something less readable just to save those few bytes, though. Our code checkers might complain about it, too.

@rugk
Copy link
Member Author

rugk commented Mar 5, 2017

It is not less readable. It's much more readable… 😆
Need to check the code checkers. I think they should have no reason to complain… 😃

@elrido
Copy link
Contributor

elrido commented Mar 24, 2017

Reopening to keep track of necessary changes this requires:

  • README and INSTALL (and their wiki counterparts)
  • All translation files

@elrido elrido reopened this Mar 24, 2017
@rugk
Copy link
Member Author

rugk commented Mar 24, 2017

wiki updated. As for translation files going with %s is a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

2 participants