View Issue Details

IDProjectCategoryView StatusLast Update
0005480Composrcorepublic2024-03-30 03:25
ReporterPatrick SchmalstigAssigned To 
SeverityFeature-request 
Status non-assignedResolutionopen 
Product Version 
Fixed in Version 
Summary0005480: Rewrite do_lang and do_lang_tempcode to not ignore params when previous params are null
DescriptionIn do_lang:
 - If param 1 is null, param 2 and 3 is ignored
 - if param 2 is null, param 3 is ignored
Rewrite the function to not do this. Treat null as empty string, perhaps, when passing in to the language.

In do_lang_tempcode:
I think for every null parameter, future parameters are mapped to previous parameters. For example, if param 1 is null, then 2 becomes 1 and 3 becomes 2, etc. Rewrite do_lang_tempcode to not do this; treat null as empty string.
Additional InformationThis is a consistency fix. It might break a lot of things, so implement with care.

EDIT: See comments; we've decided on an alternative solution.
TagsRoadmap: Over the horizon
Time estimation (hours)
Sponsorship open

Activities

Chris Graham

2024-03-24 19:52

administrator   ~0008422

It is done the way it is for performance reasons. Looping over 3 inputs for every language string referenced is not trivial when thousands may be. Let's say there's 1000 language strings being referenced, and the difference between checking 1 vs 3 parameters is a microsecond. That's 1 millisecond. Let's say our performance budget is 200 milliseconds.. that's 0.5% of our performance budget just for this one tiny thing that can be avoided by not providing parameters incorrectly.

Patrick Schmalstig

2024-03-25 17:04

administrator   ~0008440

I think an alternative then should be a new automated test if there isn't one to check for these cases where a null parameter is passed before a non-null one. There are instances of this in the v11 codebase.

Chris Graham

2024-03-27 13:40

administrator   ~0008458

Fundamentally it's impossible to do fully with linting, as most cases of this will be happening when variables are being used rather than static values.

What would work is in dev mode checking the parameters are valid at the start of the function. Then it's much harder for us to miss, during our basic development cycles.

Patrick Schmalstig

2024-03-27 14:01

administrator   ~0008465

So are you suggesting a dev mode clause within the do_lang / do_lang_comcode functions where if a parameter has null and a later parameter does not, we warn_exit about that?

Chris Graham

2024-03-28 14:05

administrator   ~0008472

Yes

Patrick Schmalstig

2024-03-28 16:21

administrator   ~0008476

Okay, I can do that.

Issue History

Date Modified Username Field Change
2023-11-28 10:21 Patrick Schmalstig New Issue
2023-11-28 10:22 Patrick Schmalstig Tag Attached: Risk: Changes core website behaviour
2024-03-24 19:52 Chris Graham Note Added: 0008422
2024-03-25 17:04 Patrick Schmalstig Note Added: 0008440
2024-03-27 13:40 Chris Graham Note Added: 0008458
2024-03-27 14:01 Patrick Schmalstig Note Added: 0008465
2024-03-28 14:05 Chris Graham Note Added: 0008472
2024-03-28 16:21 Patrick Schmalstig Note Added: 0008476
2024-03-28 16:21 Patrick Schmalstig Additional Information Updated View Revisions
2024-03-28 16:21 Patrick Schmalstig Tag Detached: Risk: Changes core website behaviour
2024-03-28 16:22 Patrick Schmalstig Tag Attached: Roadmap: Over the horizon
2024-03-30 03:23 Patrick Schmalstig Project Composr alpha bug reports => Composr
2024-03-30 03:25 Patrick Schmalstig Category General / Uncategorised => core