WordPress – 'strpos() empty needle' and 'cannot modify header' warnings
-
I have asked this on stackoverflow too.
Months ago, I have placed a 301 redirect rule in my
.htaccessfile to redirect all thewwwrequest to anon-wwwrequest.The problem is two days ago, when I tried to access my
example.netsite usingwww.example.netI get the following warnings in the page and website is not loaded.http://i.stack.imgur.com/nXBMF.png
Here are the corresponding lines:
1. Plugin.php Line 647 =
if ( strpos( $file, $realdir ) === 0 ){Full function:
/** * Gets the basename of a plugin. * * This method extracts the name of a plugin from its filename. * * @since 1.5.0 * * @param string $file The filename of plugin. * @return string The name of a plugin. */ function plugin_basename( $file ) { global $wp_plugin_paths; foreach ( $wp_plugin_paths as $dir => $realdir ) { if ( strpos( $file, $realdir ) === 0 ) { /** LINE 646 */ $file = $dir . substr( $file, strlen( $realdir ) ); } } $file = wp_normalize_path( $file ); $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir $file = trim($file, '/'); return $file; }2. Pluggable.php Line 1178 =
header("Location: $location", true, $status);Full file: http://pastebin.com/0zMJZxV0
Forgive me if this is a dumb question. I am a med student and I use wordpress only to write some articles. My PHP knowledge is very basic and limited only to locate errors.
Please help me figure out the problem with this. As I have read from the Codex FAQ, they say that empty strings may be a culprit for the
pluggable.phperror. But I have no idea how to locate it and I have attached the file for your reference.Please advise me to add any additional details or if anything is missed here. Also, provide your suggestions to avoid this error in the future. Thanks in advance.
3.
wp settingfile: (the error line –include_once( $plugin );)// Load active plugins. foreach ( wp_get_active_and_valid_plugins() as $plugin ) { wp_register_plugin_realpath( $plugin ); include_once( $plugin ); } unset( $plugin );I have tried all the points in the CODEX faq. I still couldn’t fix the error.
The topic ‘WordPress – 'strpos() empty needle' and 'cannot modify header' warnings’ is closed to new replies.