Here is one for the strange WPMu bugs division. I had tested the upgrade to WPMu 2.6 for UMW Blogs pretty thoroughly, but there was one small thing I missed. Which manifested itself as an error message, shown below, every time I tried to upload an image or document.
Warning: strpos() [function.strpos]: Empty delimiter in …./public_html/wp-includes/wpmu-functions.php on line 1586
Given that uploading images and documents is not an insignificant feature for UMW Blogs, I was a bit concerned. So, I searched high and low on the forums and elsewhere for a solution, but all to no avail. Finally, I asked the ever great Zach Davis of Cast Iron Coding fame—whose stint with me in grad school has gained him nothing but an endless stream of code questions for over three years now—if this was a problem with the .htaccess file given this fix for the issues with uploading images on WP 2.5. But given it was a PHP error it seemed unlikely, or so Zach informed me 🙂 So, he did me an ace and looked at the code and asked me the following two questions:
Zach: Have you set an option for upload_filetypes?
Me: Yes, jpg jpeg png gif mp3 mov avi wmv midi mid pdf rtf doc xls ppt docx xlsx odt ods swf m4v
Zach: Is there a trailing space or a leading space?
Disco! There was a trailing space in the Upload File Types field in the Site Admin–>Options tab. I got rid of the trailing space and the upload error went away. Now that is code diagnostic prowess, two questions and my problem was fixed, it would have taken me all night and I would have sacrificed those wee hours of blogging bliss too. But, I was spared the knife again thanks to my betters. One day I will learn how to read PHP code, but until then I’ll just have to hail Zach!
Gosh, I almost didn’t get past the title of this blog post. That is true wordplay at its best, my friend, had me in fits of giggles.
Then I read the post & understood the words “ace” & “disco,” & not much else! Oof, just leave the code to the men who know it best.
This is truly one of those posts that I feel compelled to write in hopes that Google will find it, and help some other code ignorant soul like myself through a trailing space that they can’t seem to find their way out of. I always feel bereft when Google can’t solve my WPMu code problem, compelling me to throw a ridiculously nonsenesical post like this out into the ether.
Yet, when you search for this phrase on Google now this post shows up first, which was my strategy all along. It ain;t no Texas Chainsaw Massacre, but it serves a niche audience of WP junkies 🙂
Oh man, that’s genius! How fascinating a way to help other people, creating loop-holes & directives for the lost coding soul. It’s ma-Google-pulation, that’s fantastic!
I know PHP and 90% of the time when an error comes up the first thing I do is google. Often it is in the vain hope that somebody out there has done exactly this, post the problem and the solution. Thank you Jim!
I too rely heavily on Google to find mention of error messages; has saved my butt more times than I can count.
Of course a trim() in the code as content is sucked in can prevent the tragic result.
All Hail Zach!
Pingback: Seltsamer Fehler in Wordpress! | Bloggers Blog
Google has indeed found it and it’s been a great time-saving post! If only all WPMU “bugs” were so easily remedied. Thanks Jim.