Recently we faced an issue of form not submitting with all form fields. Let me describe the issue in details.
In CiviCRM, when creating a new Contact or updating an old one, selected tags were not saving. This was working before but suddenly this issue arose. After thorough investigation we discovered that not all fields of the form was posted or in other words the PHP $_POST variable have not listed all fields. In our Windows machine we got all the fields but in Linux box the issue existed. First we thought the issue might have caused due to the PHP directive “post_max_size”, though it was set to 24M. We tried with updating it to 128M. But the issue was still there.
Then we searched Google and got a clue from http://akrabat.com/php/missing-fields-in-_post/. Our server was using PHP 5.3.22. So, we looked for the “max_input_vars” directive which was new since 5.3.9, it was set to 1000 by default. We increased the number to 2000 and the issue was resolved.
Due to the number of groups in the form, the field number increased to more than 1000. So, PHP was truncating the POST data and at most 1000 fields were returned. That’s why Tags fields were not listed in the $_POST variable.
In one of our Drupal projects, when the CRON URL was accessed it was showing the Access Denied page. After doing some R&D we found that the issue was due to the Apache Solr module. The Apache Solr module’s CRON function was failing to index nodes. Finally we found the reason why this was failing and redirecting to Access Denied page. The reason was we had implemented the hook_node_view() to check permission when content of a particular type was accessed. So, when Apache Solr tried to index content of this type, it was failing to do so due to the permission required to view the content. It then redirected the call to access denied page. After bypassing the code in hook_node_view() with the following condition it started working.
'search_index' != $view_mode
FYI, $view_mode is the second parameter of hook_node_view().
The following link gave us an idea about the issue.
A few days back I was working on an OpenERP project. I had to develop a module for it. I created a module and it was working fine is my Windows machine. When I uploaded the module to Linux installation, I could not find the module in the module list. I double checked if it is uploaded in correct directory or not… it’s in the right place. Tried with updating the module list several times… no luck!
Then one thought came in my mind. In one of my previous projects I faced an issue (though that was not an OpenERP project). It was related to end of line (EOL) character. I checked the module files and found that it was using Windows EOL characters CRLF. I changed the character to Unix EOL character LF. Uploaded the files again on Linux server, restarted server, updated module list and found the module in the list.
How I changed the character?
I have used Notepad++ to do this task. You may follow the following steps to do this:
- Download and install Notepad++ if you do not have it.
- Open the module file.
- To view the EOL character go to View menu > Show symbol > Show End of Line.
- If the EOl is CRLF then proceed to next steps. If the character is LF then no need to change.
- To change the EOL to Unix format, go to Edit > EOL Conversion > Unix format. You will see the EOL changed from CRLF to LF.