The company I work for are using Customer Area for one of our clients and everything has been great until recently. When a private file is tried to be downloaded we get several error messages appear:
Notice: Undefined index: force-download in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php on line 1029
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php:1029) in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-default-handlers.class.php on line 945
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php:1029) in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-default-handlers.class.php on line 952
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php:1029) in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-default-handlers.class.php on line 955
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php:1029) in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-default-handlers.class.php on line 956
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php:1029) in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-default-handlers.class.php on line 959
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php:1029) in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-default-handlers.class.php on line 960
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php:1029) in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-default-handlers.class.php on line 961
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php:1029) in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-default-handlers.class.php on line 989
When trying to reset the plugin settings or database through the plugin we also get the error:
Notice: Undefined index: cuar_admin_theme_url in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-classes/settings.class.php on line 674
Warning: Cannot modify header information - headers already sent by (output started at /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-classes/settings.class.php:674) in /Users/mathew/Websites/mamp/portal-test/wp-includes/pluggable.php on line 1216
We are using our own WordPress theme which we have removed all customised WP Customer Area templates, and even switched themes to TwentySeventeen but the errors still appear. As well as switching themes we have tried uninstalling and reinstalling the plugin.
So we decided to create a new blank WordPress environment and test it there and re-download the plugin so it is new. The download button then began to work but when testing for a second/third time the errors returned.
As previously mentioned the plugin was working perfectly up until being discovered yesterday. We haven’t edited any of the core files only the template files which we did by following the instructions of WP Customer Area. The site is running WordPress 4.9.1 and plugin version is 7.4.5. However, we have tried with Wordpress 4.9 and plugin versions 7.4.0, 7.3.0.
If anyone can help with this it would be greatly appreciated. Thank you for taking the time to read my message.
Thanks
I got in touch with the people at WP Customer Area and they are looking into the issue as it seems to be a bug in the plugin. But in the meantime they have given me some code to stop the errors by replacing:
!isset($_GET['force-download']) && $_GET['force-download'] != 1)
On line 1029 in customer-area/src/php/core-addons/private-file/private-file-addon.class.php.
with the line:
if ( !isset($_GET['force-download']) || (isset($_GET['force-download']) && $_GET['force-download'] !== 1))
This has helped me with the errors and hope it helps you guys as well.
Unfortunately you will probably need to chase this bug through a lot of code, but the general fix is to identify situations where an array key is assumed to be existing and fix it with some code.
The error tells you where to start:
Notice: Undefined index: force-download in /Users/mathew/Websites/mamp/portal-test/wp-content/plugins/customer-area/src/php/core-addons/private-file/private-file-addon.class.php on line 1029
From the index name, force-download I would guess this is the value of a checkbox on an HTML form. When unchecked, no value is passed via HTTP POST yet the script is looking for this in $_POST (guessing here).
The best advice I can give is to fix the instances of this with something like:
<?PHP
if( array_key_exists( 'force-download', $_POST ) && $_POST['force-download'] )
{
// do something
}
?>
What I do for my forms:
In order to always have a $_POST value, I output a hidden form field with a zero value before the checkbox field. Then the checkbox field has a value of 1. That way the checkbox field, if checked, passes '1' via $_POST and my if statements just work without having to always be constantly be checking for empty, array_key_exists, etc.
Related
Not sure when this occurred but when editing a category, this error is given at the top of the edit category page.
Warning: call_user_func_array() expects parameter 1 to be a valid
callback, function 'my_category_custom_fields' not found or invalid
function name in /home2/sirenon2/public_html/wp-includes/plugin.php on
line 525
Line 525 is call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
When I submit on the edit category page, it gives me the original error plus:
Warning: Cannot modify header information - headers already sent by
(output started at
/home2/sirenon2/public_html/wp-includes/plugin.php:525) in
/home2/sirenon2/public_html/wp-includes/pluggable.php on line 1228
Line 1228 is header("Location: $location", true, $status);.
Any ideas on what the problem is and how to fix it? I do have custom fields on my edit category pages.
Thanks
Either one of installed plugins has error which is throwing above error or you need to update wordpress or PHP. There may be compatibility issue of WordPress with installed PHP version. Few of WordPress's functions might have been updated.
If updating doesn't works, simply go to wp-config.php file and set this constant to false. If this line is not there into config file, add it.
define('WP_DEBUG', false);
I also have this problem before. But I change output_buffering to On. You can find it from PHP.ini.
Or refer this url http://chevronscode.com/index.php/wordpress-header-error-wp-includespluggable-php.html
This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 7 years ago.
After i moved my files from my localhost "iis" to apache on a webhotell. I keep getting this error that says "Warning: Cannot modify header information - headers already sent by (output started at /home/waiokqbg/public_html/index.php:37) in /home/waiokqbg/public_html/Engine/php/classes/users.class.php on line 50"
It says that headers aldreay sent by index.php on line 37, and here
how the code looks like on line 37 index.php:
<div id="loginwrap" <?php if(isset($_GET['noticelogin'])){echo"style='display: block'";} ?>>
and in users.class.php on line 50:
header("location: http://www.mediaview.nu/index.php?noticelogin=0");
Help would be appreciated
When you use a header, you have to make sure that there is no code that has been rendered above it, like HTML for example.
Consider the following example:
<?php
...
header("location: http://www.mediaview.nu/index.php?noticelogin=0");
...
?>
<html>
...
Any header calls must be made before any output is sent.
You can read more about it here.
It means that there is some extra information before php execution :
makes sure you are following layout.
------- There should not be anything here----------
<?php
echo "your code here";
?>
It is not an error # line 50. May be your code sent an error message before and when line 50 arrives you get this message.
I suggest you, run this code separately in order to get the first error message.
You can run writing an URL with dummy parameters for instance
index.php?noticelogin=OK&anotherparame=TEST
I am trying to rename the menu items in v tiger crm. I googled but I could not get the right information. I try to change the menu items and getting the following warnings.
'contacts'=>'customers' in include/language/en_us.lang.php
Warning: Cannot modify header information - headers already sent by (output started at ``vtigercrm/include/language/en_us.lang.php:1) in vtigercrm/index.php on line 606
Warning: Cannot modify header information - headers already sent by (output started at ``/vtigercrm/include/language/en_us.lang.php:1) in vtigercrm/index.php on line 608
Warning: Cannot modify header information - headers already sent by (output started ``at/vtigercrm/include/language/en_us.lang.php:1) in vtigercrm/index.php on line 610
use
ob_start (); and ob_flush();
in your index.php and en_us.lang.php pages the problem will solve.
1- that error states there is a blank line before the opening php statement or 2- you may save en_us.lang.php in utf8 format.
solution:
for 1: remove any extra line(s) before <?php and Also after ?> at the beginning and the end of
mentioned file. for 2: use notepad++ to convert encoding to
UTF8 without BOM and then save it.
I am working on a ngo PROJECT. I prepared some stuff on my localhost and now uploaded to our test server. But when I try to open wp-admin of my wordpress, I get following warnings.
Warning: Invalid argument supplied for foreach() in /home/zooliepd/public_html/clients/sparsha/wp-includes/post.php on line 3589
Warning: Cannot modify header information - headers already sent by (output started at /home/zooliepd/public_html/clients/sparsha/wp-includes/post.php:3589) in /home/zooliepd/public_html/clients/sparsha/wp-includes/pluggable.php on line 876
In my website I made posts page to my home page.
I tried to put ob_start(): in my header file but it didn't work! and no spaces are there in post file at given line number.
Plz help me
Warning: Invalid argument supplied for foreach() in /home/zooliepd/public_html/clients/sparsha/wp-includes/post.php on line 3589
It is because foreach expects a array there, do like below :
if(is_array($your_arry)){
foreach(){....}
}
put your foreach inside this condition
If first warning is fixed the second will go automatically, because second one caused because of first. :D
All of sudden my Wordpress site displays the following:
Warning: array_unshift() expects parameter 1 to be array, null given in /home/rjames/public_html/rjamesphotography.co.uk/wp-content/themes/contrast/themolution/includes/theme-functions.php on line 37
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/rjames/public_html/rjamesphotography.co.uk/wp-content/themes/contrast/themolution/includes/theme-functions.php:37) in /home/rjames/public_html/rjamesphotography.co.uk/wp-content/plugins/si-contact-form/si-contact-form.php on line 1810
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rjames/public_html/rjamesphotography.co.uk/wp-content/themes/contrast/themolution/includes/theme-functions.php:37) in /home/rjames/public_html/rjamesphotography.co.uk/wp-content/plugins/si-contact-form/si-contact-form.php on line 1810
Warning: Cannot modify header information - headers already sent by (output started at /home/rjames/public_html/rjamesphotography.co.uk/wp-content/themes/contrast/themolution/includes/theme-functions.php:37) in /home/rjames/public_html/rjamesphotography.co.uk/wp-includes/pluggable.php on line 866
Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
It was fine for about 3/4 days and now I get this. I can't even log into the admin side to have a look... Could anyone point me in the right direction - I'm not too hot on PHP.
Thank you.
Your theme is stuffing up
you can try to change theme programatically like this directly in the database
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'template';
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'stylesheet';
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'current_theme';
Hopefully then you can login. try this on your development environment first before doing it in production
Your only issue here is the array_unshift() error. The rest of the messages are a result of that. So only the array_unshift() issue needs to be fixed.
Not sure what is causing it from this message though, what's on line 37 in wp-content/themes/contrast/themolution/includes/theme-functions.php??