View Issue Details

IDProjectCategoryView StatusLast Update
0026063mantisbtcode cleanuppublic2019-08-25 12:36
ReporterRealityRipple Assigned Todregad  
PrioritylowSeveritytrivialReproducibilityalways
Status closedResolutionfixed 
Product Version2.21.2 
Target Version2.22.0Fixed in Version2.22.0 
Summary0026063: Glue after String Array is being Deprecated
Description

The Join() function will soon be strict on the order of its parameters (PHP 7.4), so any mismatches there will need to be changed. So far, I've only found an instance of the wrong Join() order: on line 653 of "core/layout_api.php"; but there may be others.

TagsNo tags attached.

Activities

atrol

atrol

2019-08-22 14:28

developer   ~0062628

Thanks @RealityRipple for entering the issue.

The Join() function will soon be strict on the order of its parameters (PHP 7.4)

The same applies to implode() as join() is just an alias for implode()

so any mismatches there will need to be changed

Not sure if it's needed or just good to have for the moment.
@RealityRipple did you try if it doesn't work?

According the PHP Wiki it should work, but emit a deprecation warning
So PHP 8.0 should be the first version where it must be changed.

For historical reasons, the implode() function supports passing the $glue and $pieces parameters in reverse order from the documented order of arguments. This is inconsistent and makes the argument handling non-standard (for example, strict types are not respected). This also affects the alias join().

Proposal: Emit a deprecation warning when calling implode($pieces, $glue) or join($pieces, $glue). Calling the function with just an array continues to be allowed: implode($pieces) does not generate a deprecation warning. 

So far, I've only found an instance of the wrong Join()

I had a very short look, but there are some more.
There are also some wrong calls of implode()

RealityRipple

RealityRipple

2019-08-22 14:35

reporter   ~0062629

Last edited: 2019-08-23 11:04

At present, I can't get Mantis to run correctly on 7.4b1 - I get repeated Internal Server Errors on bug and admin pages. However, I believe you're correct in that this issue only triggers a warning in 7.4. That's why this is under code cleanup and not an actual error.

Edit: Sorry, I said alpha, but it's beta. Unimportant, but just in case anyone else tries to run Mantis on b1, it'd be best to have some confirmation that there's some teething issues.

atrol

atrol

2019-08-22 14:56

developer   ~0062630

At present, I can't get Mantis to run correctly on 7.4a1

IMO not worth to invest time in going on to try it, as there is 7.4.0beta4 available

RealityRipple

RealityRipple

2019-08-22 15:04

reporter   ~0062631

I'm aware and waiting for my webserver's host to update their 7.4 version. That's why I haven't gone through and tried to find all the causes of the ISEs and report them as bugs. As far as I know, though, this particular issue does not contribute to the failures I run into. Just a warning in the ol' error log.

dregad

dregad

2019-08-23 06:27

developer   ~0062637

PR https://github.com/mantisbt/mantisbt/pull/1550

atrol

atrol

2019-08-23 09:19

developer   ~0062639

@dregad while you are on it https://github.com/ADOdb/ADOdb/blob/master/pear/Auth/Container/ADOdb.php#L202

dregad

dregad

2019-08-23 10:14

developer   ~0062640

Thanks for the heads up, I'll fix that

Related Changesets

MantisBT: master 7ab90f60

2019-08-23 02:07

dregad


Details Diff
PHP 7.4: remove deprecated usage of implode()

Passing parameters to implode() in reverse order is deprecated

Fixes 0026063
Affected Issues
0026063
mod - api/soap/mc_api.php Diff File
mod - api/soap/mc_file_api.php Diff File
mod - core/error_api.php Diff File
mod - core/file_api.php Diff File
mod - core/filter_api.php Diff File
mod - core/install_helper_functions_api.php Diff File
mod - core/layout_api.php Diff File
mod - core/news_api.php Diff File
mod - core/print_api.php Diff File
mod - manage_plugin_page.php Diff File