I am experiencing a problem with Wordpress.
Everything seems to work fine, but with the usage of some (3rd-party)-Blocks in the Gutenberg-editor, something is causing an issue, I assume with Java.
If the content in Wordpress is saved, an error occurs:
Updating failed. The response is not a valid JSON response.
There is not more to the error. Debug enabeling in wp-config does not log any errors. If I am right, this is correct, because this debug-function in WP would only log php related issues.
On the Internet there are all kinds of random solutions to fix this error (change permalinks as an example). Does not do anything for me. More random solutions are deactivating all plugins. Still, the issue persists. Update Wordpress and php. Done. Error persists.
All the above seems to be "searching in the dark". So I would like to know, how to find out, what the acutal issue is. Surely, there must be some kind of debugging?
I found something somewhere on the net in regards to get the last JSON-error from the server:
if (!function_exists('json_last_error_msg')) {
function json_last_error_msg() {
static $ERRORS = array(
JSON_ERROR_NONE => 'No error',
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)',
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
JSON_ERROR_SYNTAX => 'Syntax error',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded'
);
$error = json_last_error();
return isset($ERRORS[$error]) ? $ERRORS[$error] : 'Unknown error';
}
}
?>
If I understood this right, the above code should go in a .php-file, which I call trough the browser. Did it, tried it. Browser window remains just blank. So either this is not working for me, or there is just no error stored?
Who can point me in the right direction?
I also did create two test pages in WP, and tried to save both. One without the error causing element, and one with. Both attempts have been logged, using the Borwser's Developer-Tools on the "network" tab. If anybody thinks, this would be of help to evaluate the issue, let me know and I will upload them.
Related
I've encountered an issue when trying to update a site's(group) template. The template is assigned and works correctly but a couple errors are thrown when doing so. They all read the same thing:
2023-01-18 10:42:24.934 ERROR [http-nio-8080-exec-48][FragmentRendererControllerImpl:120] Unable to render content of fragment entry 0:com.liferay.fragment.exception.FragmentEntryContentException: com.liferay.portal.kernel.portlet.PortletContainerException: java.lang.IllegalArgumentException: Someone may be trying to circumvent the permission checker: {company>
2023-01-18 10:42:24.936 ERROR [http-nio-8080-exec-48][FragmentRendererControllerImpl:120] Unable to render content of fragment entry 0:com.liferay.fragment.exception.FragmentEntryContentException: java.lang.NullPointerException
this is not an error i understand. As i'm not checking for permission, someone without permission simply wouldn't see the button and couldn't press it. I have code for that in my view.jsp, but even when i remove it the error still persist.
This is the code i have for updating a group:
// I first update a custom field showing if the site is active or not
group.getExpandoBridge().setAttribute("Status", "Actief" );
LayoutSetLocalServiceUtil.updateLayoutSetPrototypeLinkEnabled(groupId, true, true, privateTemp);
Like I said I tried removing any permission checking code but this had no effect. The method i'm using is from the LayoutSetLocalServiceUtil class. Given that it's a local this method shouldn't check for permission either. I'm also logged in as admin when I try to run my code so I should have the permission to do this anyway.
I also tried to hide the error using:
SessionMessages.add(portletRequest, PortalUtil.getPortletId(portletRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
But this didn't actually hide it for some reason and it doesn't solve the issue either. Did anyone encounter this before? And why do i keep getting a permission error without checking any permission?
I had similar permissions issues during the execution of custom code that updated ExpandoBridge attributes. Try the following update:
boolean isSecure = false; // Forces the use of ExpandoBridgeLocalService w/o permissions checking
// I first update a custom field showing if the site is active or not
group.getExpandoBridge().setAttribute("Status", "Actief", isSecure);
LayoutSetLocalServiceUtil.updateLayoutSetPrototypeLinkEnabled(groupId, true, true, privateTemp);
Reference:
https://docs.liferay.com/dxp/portal/7.4-latest/javadocs/portal-kernel/com/liferay/expando/kernel/model/ExpandoBridge.html#setAttribute-java.lang.String-java.io.Serializable-boolean-
I have set some error code and message in a JSON file in my project which looks like (not original code for safety):
{
"ERROR":"Limit is £100."
}
When I set this message to be thrown as exception when testing from Postman, instead of showing Limit is £100., it shows like Limit is ?100.
So, I'm worried why £ gets converted to ?. Then, I tried to replace this ? with £ by using below code:
String message = fetchErrorMessage("ERROR", ***some parameters***);
if (message != null) {
message = message.contains("�")
? message.replaceAll("�", "£")
: message;
}
Note: I checked with � instead of ? because when I was debugging the code and hover over the message to check whether it contains the £ symbol or not, I found that it was having a weird looking square block (check screenshot below). So, I copy-paste it and got to know it's a question mark symbol inside a black diamond.
Now, with above piece of code change, the message is coming properly in Postman but soon I realized that when I deployed the code in UAT environment, it still shows ?.
So, any workaround how to fix it?
There is a specific character that shows up wrong when UTF-8 is set from the client(SoapUI) in the header content-type: application/json;charset=UTF-8.
For more details Check this link
I am working with ESAPI to try and validate windows directory paths. For some reason, the part of my directory path named \14\ is getting converted into a CRLF. The error I am receiving is below, what am I not understanding correctly? I feel like my regex should be working.
WARN IntrusionDetector [SECURITY FAILURE Anonymous:null#unknown -> /project-test/IntrusionDetector] Invalid input: context=directoryPath, type(DirectoryName)=^[a-zA-Z0-9:/\\!##$%^&{}\[\]()_+\-=,.~'` ]{1,255}$, input=C:\UsersTESTUS~1AppDataLocalTempTestCase8002TempWorkSpace, orig=C:\Users\TESTUS~1\AppData\Local\Temp\14\TestCase8002TempWorkSpace
As you can see, I am using the regex:
^[a-zA-Z0-9:/\!##$%^&{}[]()_+-=,.~'` ]$
My input is:
C:\Users\TESTUS~1\AppData\Local\Temp\14\TestCase8002TempWorkSpace
Ouput, after ESAPI does canonicalization and validation:
C:\UsersTESTUS~1AppDataLocalTempTestCase8002TempWorkSpace
Here is the line of code that causes me to receive the error;
String validatedSourcePath = ESAPI.validator().getValidInput("directoryUnzip", directory, "DirectoryName", 255, false);
File validFile = new File(validatedSourcePath);
#C.Williams: I was about 30 minutes into writing up a detailed reply in an editor and accidentally excited my editor window. I'm too ticked off at my stupidity of not saving it to write it again, especially since I was only about 75% done.
However, if you want to email me I can arrange to talk to you via Google Hangouts or Signal to tell you want your problem is and how you can fix it. But it's long and complicated and partially related to a bug the ESAPI team just fixed but is not in any official release yet. But I am not going to take another 45 minutes or more trying to reply with any written text. My email address should be easy enough to find. Just google for my name and ESAPI. I am one of the project co-leaders on ESAPI.
-kevin wall
I am trying to create a simple login/register system for my Android app. I am following a tutorial by David Kelley (http://davidjkelley.net/?p=48). I downloaded the project David created and it works fine.
However, when I try making a copy of the project and change the relevant lines of code (and package name) to link to my own server, I get errors when I try registering a new user. The two main errors that show up in the logcat are:
<b>Fatal error</b>: Class 'DB_Functions' not found in <b>/home/paid2read13/paid2read.net/android_api/index.php</b> on line <b>18</b><br />`
- Error parsing data org.json.JSONException: Value db of type java.lang.String cannot be converted to JSONObject
...FATAL EXCEPTION: AsyncTask #1 ... java.lang.RuntimeException: An error occured while executing doInBackground()... Caused by: java.lang.NullPointerException at com.moneytree.RegisterTask.doInBackground(RegisterTask.java:85)...
In order for this post to be as useful as possible for me and anyone with similar issues, let me be very clear about what I changed from the code in the website given above:
In all of the classes in the main package (LoginTask.java, RegisterTask, etc.) AND the library (UserFunctions.java and DatabaseHandler.java), I changed loginURL = "http:// davidjkelley.net/android_api/" and registerURL = "http:// davidjkelley.net/android_api/" to loginURL = "http:// mydomainname.net/android_api/" and registerURL = "http:// mydomainname.net/android_api/", respectively. I also changed the database details in config.php to match my details; for the server name I put mysql.mydomainname.net because this link brings up my phpmyadmin console and it says server: mysql.mydomainname.net at the top of that page. So I think config.php is set up fine.
I don't know why the app "can't find DB_Functions" - I placed the files as instructed at the beginning of the aforementioned tutorial. I'm also not sure what exactly the null pointer issue is referring to.
I've been stuck on this for at least a week and have gone through all related issues; I found nothing similar. I would be very much grateful if anyone could help me with this - I wanna move ahead with my project. Thank you.
I am working in Solr and making some filter quires. One of my filter is consists of a space
for eg:- "fq=listing_type:New home"
But this is giving error. No result is comming out.
I also tried "fq=Listing_type:New+home"
This was not giving error. But no results are comming out. Event there is some xml which have thse values.
Can anyone tell me where is my error?
Here you see the schema.xml
Have you tried with fq=listing_type:"New home" ??? Why dont you index this field as "NewHome" ?