Cannot re-assign auto-global variable _FILES (& _POST)

meanster99

Well-known member
Apache Version 2.4.12
PHP Version 5.5.25
MySQL Version 5.5.42-cll
Architecture x86_64
Operating System linux

Dadabik version 4.0

I am using an old (but customised version of Dadabik), so I can't upgrade (at least I don't have the time to attempt it yet!). I think my webhost must have just upgraded their version of php on the server as my database became inaccessible overnight. I couldn't even sign in, just a white page of death.

I checked the error logs and saw this error:

Cannot re-assign auto-global variable _POST mydomain/database/include/business_logic.php on line 506

A quick search of this error suggested the use of global variables as parameters in functions is not permitted in php v5.4 or above. I know this issue was resolved in a later version of Dadabik but as I said, I can't upgrade at the moment.

It appeared the easiest solution was to just remove the _FILES & _POST from the function parameters (in all functions that they appeared in, not just on line 506) and everything would work OK still as they are global variables and so should be available anyway, without adding them to the parameters of the function. So I did that and I was then able to sign in and access my database again. Great!

However, now whenever I click 'edit' on any record, the record view is completely blank - all field names display but are completely empty. If I click 'view' record instead I can see all the data OK, so the data is there still, it's just not showing it under 'edit' record.

I'm a complete noob at php (and the only way I was able to make customisations was with the help of members of this forum), so I can't work out what needs changing myself. I only removed the instances of _FILES and _POST from all function parameters in business_logic.php. I haven't really made that many customisations to business_logic.php, so if it's the only file that gets affected by this issue then I should be able to update this single file without too much trouble.

Just so you know I did donate over £100.00GBP for version 4.0 of Dadabik (before you started to charge!), so I'm hoping you can help me more than just telling me to pay to upgrade (maybe even provide me an updated version of business_logic.php?).

Really hoping you can help!
Thanks,
Matt
 

meanster99

Well-known member
Actually, I'm not sure I'm using v4.0 of Dadabik. I can't seem to find the version number anywhere - where can I find it please? I've read that v4 is over 8 years old, but I only started using it maybe 3 or 4 years ago, so perhaps I have a more recent version.
 

eugenio

Administrator
Staff member
Hello,
version 4.0 is very old and it has bugs (even security bugs) so my advise of course is to upgrade. You can see the version following this procedure:
- right click on a page
- choose "view source" or "view HTML"
- look for meta tag "generator"
however, a few DaDaBIK 4.x versions had the wrong tag here.
Last releases of DaDaBIK allow to see the the version from the "check upgrade" page in the admin panel.

A quick fix could be (not 100% sure it will work) replace all the $_POST and $_FILES in business_logic.php with $_POST_2 and $_FILES_2; even if it works, you are still using a software which is "half patched" and contains bugs, DaDaBIK 5 and 6 came with huge changes so a manual upgrade of the code would be extremely complicated and time-consuming.
 

meanster99

Well-known member
Hi Eugenio,

Thanks for the reply. The generator tag says it's version 4.3. Whatever version I'm using it was the latest version at the time (around 3 years ago).

Yes, I do think an upgrade probably isn't worth it unless I start from scratch again (which would also be a big job), so I may have to make do with a quick fix (if it works!).

So for the suggested quick fix - do you mean change EVERY instance of $_POST and $_FILES in business_logic.php with $_POST_2 and $_FILES_2 (so in the function parameters and everywhere it appears in the function aswell?).???

Thanks,
Matt
 

meanster99

Well-known member
Hi Eugenio,

That appears to have worked perfectly (at least it's solved the issue of the non-showing data). I guess I'll find out in due course if it has caused any other issues.

Thanks for your help. I'll happily buy the new Dadabik for the next project I need a similar database for!

Cheers,
Matt
 
Top