WP 4.6+ update breaks custom registration page, but WP 4.5.4 works fine?

I have a site that I haven't done tests on for awhile, and just noticed that registration has NOT been working since WP4.6+.

The site has a custom registration page using Blogs MU theme, Buddypress, and Pro-Sites. It has worked fine up through WP 4.5.4 (and still works fine when I revert to that WP version).

WP 4.6 and 4.6.1 both break the blog registration process, e.g., a message says the selected blog name has already been used -- no matter what name is entered. So long as I revert to WP 4.5.4 all is well...

The registration page is highly customized. Basically I'm looking for help in identifying what changed in WP 4.6+ with regard to registrations and signups -- relative to WP 4.5.4 -- I'm presuming something got depreciated requiring alternative language.

  • Adam Czajczyk

    Hello xbladerunner,

    I hope you're well today and thank you for your question!

    This would be difficult to diagnose without knowing that custom code that you are using. However, you have mentioned that you are using the Blogs MU theme so is that registration page a part of the theme but customized or is it just a custom page that can be used with other themes too?

    If it's "separate", could you just try to switch WP to other theme to see if it's your code indeed or a theme breaking it?

    If it's not, I could make use of that customized code in order to be able to diagnose this. You could either post your code in a service like pastebin.com or upload it to github or just make a .zip archive out of it and then upload to any file storage service (e.g. Google Drive, Dropbox etc).

    Once you do this, please share a link to it with me here so I could access and check the code.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello xbladerunner!

    Thank you, I downloaded these files and reviewed them. It seems though that I'd need to run a full debugging in order to find out what's breaking the site.

    The trouble is that... I don't have a Blogs-MU theme at hand. It's a long discontinued theme and it's not even available from out sites. I just scanned my personal archives but it seems that I must have deleted it since I have no questions about it for really long time.

    I believe that I could locate that but it might be much faster if you could help me with this once again. Having that said, can I ask you to upload (preferably as a zip file) full Blogs MU parent theme (original one) and your full child theme? I think that would be the fastest solution. I'd then install it on my setup and debug in order find out if there are any tweaks/changes possible that could make it work.

    Best regards,
    Adam

  • xbladerunner

    Thanks Adam,

    You can find the zip here. Also note that child theme functioning may depend on specific buddypress and pro site settings/configurations... I can grant access to the production site (currently running WP 4.5.4 and Prosites 3.5.1.9) if you need to match the settings. *Prosites 3.5.2+ breaks the functioning of New Blog Templates (unclear if it is related to the custom registration code or not).

  • Adam Czajczyk

    Hello xbladerunner!

    Thank you for providing me with the theme.

    I checked both parent and child themes and the parent theme (so a child theme as a consequence as well) is not fully compatible with current PHP version. It does work on my end though (both parent and child) with no any significant issues. The PHP incompatibility so far is at the "warnings and notices" level meaning that with WP debugging disabled it should work but anytime in near future it may stop due to changes in PHP.

    As for the initial issue. If you could grant access to your site so I could review its settings, that would be great. I'm pretty sure that it must depend on some settings as with the default setup on my end (newest WP, PHP 7.0.7, recent Pro Sites and BuddyPress) it works :slight_smile:

    Let me know when I can access the site please!

    Best regards,
    Adam

  • Adam Czajczyk

    Hello xbladerunner!

    I see that my colleagues got involved themselves in this thread so maybe they'll be able to spot the issue. Still though I'd like to compare your site's settings with my test setup but I got a little confused :slight_smile:

    The only site that I can see that has a support access granted is currently not using the Blogs MU theme (or its child theme) on the main site and is fully up to date. This is I believe because blogs MU were breaking it, is that right?

    You mentioned that "Access has been granted to the production site, which is working fine as well -- so long as wp core and prosites are not upgraded" so is that the site ("unitedresource.....com") but it's been updated now or is it other site but support access has just expired?

    I'm asking only to avoid confusion on this and to be sure that I"m checking/comparing the proper one with mine. Let me know please.

    Best regards,
    Adam

  • xbladerunner

    Thanks Adam,

    Yes, I was a little confused myself as to the best way for folks to identify the problem (if the problem doesn't present itself to be looked at...), so I went ahead and upgraded so that the problem with registration is visible... I'm hoping that I won't need to leave it in this state very long :slight_smile: If you suggest I put it back the way it was, where everything is working fine with the older versions of wp and prosites, I happy to do that, just say the word.

  • Adam Czajczyk

    Hello xbladerunner!

    Thanks for explanation. I believe I was able now to reproduce "core" registration-flow of your site on my end but still - that works fine on my end.

    I used 60601 (IL) zip code for site creation on my end as an example and I got the "mydomain.com/chicago-il-60601" site created as expected. I then tried other zip codes but with the same result. The only time I couldn't create the site was if I used the same code for the second time. I believe though that this is an expected behavior and there can be only a single site per zip code, is that correct?

    I assume that there's more to it then but since it's a production site I didn't switch it to Blogs MU child theme without getting an explicit permission from you first. Would you agree that I switched it for a moment (just to test it) or maybe you could setup a staging site that would be a "one to one" copy of your production one where I could safely test everything?

    Also, did you try a basic troubleshooting: switching off all non-related plugins to check if that changes anything?

    Let me know please.

    Best regards,
    Adam

  • xbladerunner

    Thanks Adam,

    Go ahead and switch the theme on the production site. I did try basic troubleshooting -- I was unable to discover any plugin conflicts, other than than the problem mentioned, where upgrades past WP 4.5.4 and Prosites 3.5.1.9 break registration (e.g., user gets a message that the zip code has already been used, no matter which zip code is used). FYI, the php version of the site is not 7+ (don't know off hand what it is, I believe it is 5 something) -- I'm wondering if you revert the php version on your test site if registration will still work?

  • Adam Czajczyk

    Hello xbladerunner!

    Thank you for your replay.

    I accessed the site again and realized that the Blogs MU child theme has been active there already. I just missed that because it looks different than the one you provided me with. I'm sorry about that.

    I have tested the site again trying to pinpoint the issue but still no luck, unfortunately. I'm not able to switch to the older version of PHP currently on my test setup but I'll try to do that later on after work. Meanwhile, I'd like you to run some more test:

    Please enable WordPress debugging by adding following lines to the "wp-config.php" file of your site:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);

    These lines should be placed above the "/* That's all, stop editing! */" line and once they are there please try to signup a few times more, replicating the issue. Then, please download these files from your server: "error.log" (this should be in a main folder of your WP install and/or in child theme folder - if there are both, get them both please), "/wp-content/debug.log". Rename them to error.txt and debug.txt and attach to your replay here.

    Hopefully this will give me a clue on what's going on there.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello xbladerunner!

    Thanks for sharing the logs with me. There is something that's actually a warning but bothers me a bit. There are references to "illegal string offset" which can be a bit misleading warning but it is linked to this part of the code:

    in child theme /includes/site-creation-postcodes.php file there's this code around line #125:

    $blogname         = $details['name'];
    	$blog_title       = $details['title'];
    	$blog_description = $details['description'];

    That's inside the function but I can't see the "$details" array defined anywhere in that same function and it also doesn't seem to be passed to it via arguments. Does this file hold your custom code that you are familiar with?

    I'm asking because in that case it may just be faster if you could track down the "origin" of that array. If it's globalized it may be worth either adding it to global variables list inside the "urc_sc_validate_blog_signup()" function or passing it to that function some other way. I'm not definitely saying this is it and I'll be testing that again with an older PHP version but it's worth checking as it may be affecting the script.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello xbladerunner!

    the "urc_sc_new_site_creation_details()" is a separate function so its internal variables are not available automatically inside other functions, unless they are globalized.

    Here's an example:

    function test_a() {
    $text = "test 1";
    }
    
    function test_b() {
    echo $text;
    }

    The "echo $text" in "text_b()" function would print nothing to the screen because "$text" variable is empty. That is, unless $text variable is globalized in some other part of code - that's why I asked bout the $details.

    I know that this worked well with previous WP for your and that it works also with my test setup but not with yours so I'm not sure whether this is the issue but it's worth double-checking :slight_smile:

    Best regards,
    Adam

    • xbladerunner

      Thanks Adam,

      For some reason I was thinking $details was previously defined as an array by the WP core... I know the array is purposely "cleaned out" in our custom code so that we can replace parts of the array with the zip code stuff... it does show up in a quick search of the WP codex... is $details defined as an array within WP core and passed on from there?

      Anyway, concerning the initial issue -- I was planning to upgrade to php 7.x soon, should I go ahead and do that now, or will it confuse your process of elimination/problem solving? And if you think I should go ahead and upgrade php, do you have a list of settings I need to make sure are set? (I've run across a couple situations where I have had to have additional settings for php 7 that weren't needed in 5.6)

  • Adam Czajczyk

    Hello xbladerunner!

    For some reason I was thinking $details was previously defined as an array by the WP core... I know the array is purposely "cleaned out" in our custom code so that we can replace parts of the array with the zip code stuff... it does show up in a quick search of the WP codex... is $details defined as an array within WP core and passed on from there?

    To be perfectly honest, I'm not sure. I noticed that while I was checking error logs. There was a warning regarding this and while a PHP warning doesn't break script execution it suggested that the data may not be properly carried over. Particularly, this error suggest that the $details variable in this specific content is actually not an array. "By the rules" this variable shouldn't indeed carry any data because in case of structural (functional) PHP all the variables should by default be internal to the function where they are used in. So for example:

    $details = "test"
    function my_test() {
    $details = "something";
    echo $details;
    }

    would not display "test" but "something" while

    $details = "test";
    function my_test() {
    $details = "something";
    }
    echo $details;

    would display "test" instead of "something" :slight_smile:

    That said, thinking about that more and more I'm starting to have some doubts. While I still feel that the "$details issue" may be worth addressing, I'm not sure whether this is related. After all that very code is working on my end well.

    Also, I have just switched my server to PHP 5.5.35 and still no issues there. So, it's working for me with 5.x and 7x... I have just reviewed child theme code again and whatever it sounds I have to admit that I'm quite stuck with that. It's all related to the custom solution (not to mention theme that has been withdrawn from our offer a long ago) so I don't suppose our second line support would be able to help us much with that as well.

    What I'm saying is that I sincerely apologize for the trouble and the fact that it's taking so long but... I'll have to think more about it and run much more test. The main goal here for me would be to be able to replicate the issue. If I was able to achieve that, I then can troubleshoot that in my own environment(s) and I'm sure I could find the solution.

    Having said that, I would like to ask you for yet another act of help :slight_smile: Could you please create an empty file named "phpinfo.php" in a root folder of your site and put this code inside the file:

    <?php
    
    phpinfo();
    
    ?>

    I would then be able to check your php settings and mimic them in my test environment. I hope that this may help me replicate the case.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello xbladerunner!

    Thank you. I have printed that page to PDF to keep info about your PHP config at hand and I'll run more tests and checks on my end.

    I'll get back to you here as soon as I come up with either a solution or (hopefully not) more questions. I would however appreciate a bit of patience as the issue is quite complex and unusual and since I got somewhat stuck I'll need to dig really deep :slight_smile:

    Please keep an eye on this thread!

    Best regards,
    Adam

  • Adam Czajczyk

    Hello xbladerunner!

    Thanks for granting access. I reviewed the site again and tried to use similar setup on my end. Still though, I can't replicate this and find any clues on what could be causing it.

    It's some custom code but even though the most "weird" thing here is that it works for you with older WordPress while it doesn't work with newer one but on my test setup everything works fine no matter what I do: older and new PHP versions, current and older WordPress. I admit, I'm stuck.

    Since you mentioned that you are going to upgrade PHP anyway, maybe that would be worth a try? I mean, it's all working with 7.0.7 on my end but since it seems to be very specific to your setup it an upgrade may help here.

    That said, have you also tried to setup a copy of the site on a different server (e.g. using some trial account at another provider) just to see if it would work there? This may also be worth giving a try in order to narrow down possible causes.

    Best regards,
    Adam

  • xbladerunner

    Finally figured this one out. There was an error in the original custom registration code I was using that, under earlier versions of WP was autocorrected, but under the newer versions was no longer corrected. If anyone comes across this thread who is having what they think may be a similar issue, I'll be happy to go into more detail -- but for now just wanted to post that this has finally been resolved. To be clear, the error was in my own coding, not WP or any plugins, but it never caused any problems with registration until the new versions of WP.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.