Jump to content


Photo

Code incompatible with php 5.5 and above


  • Please log in to reply
10 replies to this topic

#1 stupeur

stupeur
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 14 November 2017 - 05:48 PM

Hi everybody, I have some code that is incompatible with php 5.5 and above, so I found myself stuck to php 5.4 which causes come other trouble an some other incompatibilities i my site 

 

here is the problematic code :

 

    <section class="full-width-bg gray-bg normal-padding get-in-touch-overlay">
        <div class="row">
            <div class="col-lg-6 col-md-6 col-sm-8 col-lg-push-3 col-md-push-3 col-sm-push-2">
<h2><span style="color: #ffffff;"><?php _e('Contact Form', 'marine'); ?></span></h2>
 
                <form class="get-in-touch contact-form" method="post">                    <?php wp_nonce_field('contact_form_submission', 'contact_nonce', true,
                        true); ?>                    <input type="hidden" name="contact-form-value" value="1" id=""/>
 
                    <div class="iconic-input"><input type="text" name="name" placeholder="<?php _e('Name*', 'marine'); ?>"> <i class="icons icon-user-1"></i></div>
                    <div class="iconic-input"><input type="text" name="email" placeholder="<?php _e('E-mail*', 'marine'); ?>"> <i class="icons icon-mail-4"></i></div>
                    <textarea name="msg" placeholder="<?php _e('Message', 'marine'); ?>"></textarea> <input type="submit"
                                                                                                            value="<?php _e('Send Message', 'marine'); ?>">
 
                    <div class="iconic-button"><input type="reset" value="<?php _e('Clear', 'marine'); ?>"> <i class="icons icon-cancel-circle-1"></i></div>
                </form>
                <div id="msg"></div>
            </div>
        </div>
    </section>
 
 
please help 
thanks 
 


#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 17,842 posts

Posted 14 November 2017 - 06:25 PM

Do you have PHP's error reporting turned on?

If so, what errors do you get?

Just telling us that there is a problem is no use whatsoever. What, exactly is the problem you are experiencing?

In future, when you post code, use code tags (the "<>" button on the toolbar).
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 stupeur

stupeur
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 14 November 2017 - 06:39 PM

Thanks for your reply, and sorry 

Yes the debug is on and actually I have no error message but the form submit button remains on sending message and the form is not submitted 

when I turn back to php 5.4 / 5.3 everything works fine 



#4 AzeS

AzeS
  • Members
  • PipPipPip
  • Guy Who Asks Many Questions
  • 74 posts

Posted 15 November 2017 - 10:06 AM

Which functions are accessed in this section?
which code is behind it for example: _e (...)?
And whats the code behind where the $_POST data is sent to ?
 

Edited by AzeS, 15 November 2017 - 10:06 AM.


#5 phpmillion

phpmillion
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts
  • LocationLithuania

Posted 15 November 2017 - 10:23 AM

I believe the problem is somewhere else in your code. The only PHP code snippet in your submit button is a basic function that displays title for submit button, so if it's displayed properly, you can safely eliminate it from debug list. If you view POSt headers (you can do that using a plugin like http live headers if your browser doesn't support this feature), does data actually get posted?

 

Also, it looks you run WP. Is it the latest version (including plugins)? I somehow have a feeling the issue might be related to some antispam plugin, which might be out-of-date and cause problems with new versions of PHP.



#6 maxxd

maxxd
  • Members
  • PipPipPip
  • Advanced Member
  • 734 posts
  • LocationNorth Carolina

Posted 15 November 2017 - 01:23 PM

What plugin are you using to send your email? WordPress recommends version 7 or greater, but very much works with 5.5 and up. Also, if the plugin you're using does ajax submissions open your console and check the networking. I know there were a couple issues with Ninja Forms until a recent update that would cause behavior that sounds like what's you're describing.



#7 stupeur

stupeur
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 16 November 2017 - 04:34 PM

Thank you all

Actually I am quite a newbie to all this, 

the contact form is featured with the template and not really customisable. 

I am running the latest version of wp and everything works fine, either with php mail or wp mail smtp ( for the other contact forms from CF7) 

I think I will get rid of this contact form once and for all 

Thanks 



#8 mac_gyver

mac_gyver
  • Staff Alumni
  • Staff Alumni
  • 4,072 posts

Posted 17 November 2017 - 02:26 PM

the problem is likely in the form processing code, it's probably relying on register globals and is expecting program variables to be set that aren't. the php version change the OP made is probably, correctly, turning off register globals and the badly written code is no longer detecting that anything was submitted.


multi-purpose programming fool. well written source-code should be self-documenting. well written code should be self-troubleshooting.

#9 phpmillion

phpmillion
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts
  • LocationLithuania

Posted 17 November 2017 - 02:54 PM

mac_gyver, please correct me if I'm wrong, but I believe register globals feature was already removed in PHP 5.4?. So if script works on PHP 5.4 and stops working on 5.5, it can't be related to register globals.



#10 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 17,842 posts

Posted 17 November 2017 - 02:55 PM

Haven't register globals been off since version 4.0, about 15 years ago?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#11 mac_gyver

mac_gyver
  • Staff Alumni
  • Staff Alumni
  • 4,072 posts

Posted 17 November 2017 - 04:24 PM

i was off by one digit in the php version when writing the reply above


multi-purpose programming fool. well written source-code should be self-documenting. well written code should be self-troubleshooting.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users