-
Notifications
You must be signed in to change notification settings - Fork 107
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
App::encodeJson(): catch case that preg_replace_callback fails #1540
Comments
Hi, I just stumbled across the second situation in which preg_replace_callback does not work and returns null... |
I had the same issue! Deactivating the preg_replace... etc. part also worked! In my case, this wasn't working any more with radio buttons:
After changing the field in the table, everything worked again... |
Another insight that may help in fixing.
This DOESN'T WORK:
In my case, the dropdown gets generated automatically, so there's no need of adding it in the form manually. There's a relation defined in the database / table. I assume that's why the dropdown gets generated automatically (which is pretty awesome 😉 ) |
@PhilippGrashoff I will fix if needed immediatelly, post minimal steps to reproduce, as best as PR with test |
It's hard for me to put out a test case as I'd have to post the whole database (because of the connections) and the database is filled with real data, no test data. Therefore I made a dump of the structure, I hope this helps you!? I attached a ZIP containing:
The difference is in the "hasOne". If I remove it and there's no relation in the table, the field is just a text field. |
@bedengler just |
closing as no reaction |
@mvorisek please leave this open. This issue exists, and I will provide a test case when I have time to do so. |
@PhilippGrashoff feel free to provide, I will investigate then :) |
I stumbled across this issue while working on a more complex JsModal+VirtualPage. |
Hi Ivan, @mvorisek is still lacking demo data to debug this problem. can you get the parameters passed to App::encodeJson() in case of a failure? That would be great. I just dont find time for this at the moment. Best regards |
@IvanTonchev this IS A MAJOR ISSUE then - the regex is designed wrongly please |
Did you investigate the files I've uploaded? They also contain the JSON output...maybe that helps!? |
@bedengler please make this https://3v4l.org/LOhUU code failing with your data |
var_export.txt |
@IvanTonchev thanks, I was able to reproduce: http://sandbox.onlinephpfunctions.com/code/92fb21923f3346376baf86594299e338bf11ba5d |
@mvorisek it's a step closer towards resolution ;) |
Guys, please verify with real data. |
@mvorisek i can confirm that the fixed encodeJson() regex works in my setting (atk4/ui 2.3.1, PHP 7.3.19). |
thanks! |
Hi,
I recently managed (don't know how, but not too important) to get this error message:
Logic behind this seems that preg_replace_callback() returns null on failure. We should take care of this.
I'd go for this, WDYT?
The text was updated successfully, but these errors were encountered: