Support

Account

Home Forums ACF PRO Warnings with clean install of ACF Pro 5.0.9 and WP 4

Solving

Warnings with clean install of ACF Pro 5.0.9 and WP 4

  • Hi,

    I am getting this error after publishing a new page each time with Debug on in wp-config.php – I want to leave debug on so that I can debug the theme.

    Warning: hash_equals(): Expected user_string to be a string, integer given in /Users/myuser/Sites/theme/wp-includes/pluggable.php on line 1719
    
    Warning: hash_equals(): Expected user_string to be a string, integer given in /Users/myuser/Sites/theme/wp-includes/pluggable.php on line 1725
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/myuser/Sites/theme/wp-includes/pluggable.php:1719) in /Users/myuser/Sites/theme/wp-admin/post.php on line 233
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/myuser/Sites/theme/wp-includes/pluggable.php:1719) in /Users/myuser/Sites/theme/wp-includes/pluggable.php on line 1173
  • Oh I’m not the only one

    first time I see this error but yeah, I have the same issue.

    All my custom post types works well, it only affects posts. Don’t know why. Even if I haven’t any group fields assigned to this post type.

    It works when ACF is disabled.

    Elliot ? An idea ? I’m working on a big website for a big french group and the deadline are very thight ^^

  • My debug is set to False, and I have the error.

  • I’m getting the same errors with or without debug set to true with just wordpress and plugin running.

  • I’m having this same problem:

    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\blog\wp-includes\general-template.php:594) in C:\xampp\htdocs\blog\wp-includes\pluggable.php on line 1173

    At the time of publishing the post …

  • Same issue

    Warning: hash_equals(): Expected user_string to be a string, integer given in /Users/xxxx/Sites/xxxxx-xxxxxx/wp-includes/pluggable.php on line 1719
    
    Warning: hash_equals(): Expected user_string to be a string, integer given in /Users/xxxx/Sites/xxxxx-xxxxxx/wp-includes/pluggable.php on line 1725
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/xxxx/Sites/xxxxx-xxxxxx/wp-includes/pluggable.php:1719) in /Users/xxxx/Sites/xxxxx-xxxxxx/wp-admin/post.php on line 233
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/xxxx/Sites/xxxxx-xxxxxx/wp-includes/pluggable.php:1719) in /Users/xxxx/Sites/xxxxx-xxxxxx/wp-includes/pluggable.php on line 1173
  • Hi guys

    The function hash_equals is not used in the ACF plugin…

    if you disable ACF PRO, the issue goes away?

  • Yes, issue doesn’t show anymore when disabling plugin.

    I still have the issue if ACF Pro is the only one plugin activated, That’s weird

  • Happens also to me, three different installs when using relationship fields.

    This is not recommended approach, as you should NEVER EVER edit WP core files, but it does the magic:
    If you really need it to work, you can edit the function wp_verify_nonce in wp-includes/pluggable.php – just add $nonce = “$nonce”; somewhere in the top.

  • I also have relationship fields.

    Thx for the trick. I will use it until we find the issue

  • I get this error as well. If i make some changes to an existing post and hit “Update” or create a new post and hit “Publish” the error occurs.

    Doing a debug_backtrace, it seems to originate from acf_verify_nonce() in api/api-helpers.php where wp_verify_nonce() is called on line 1034. The value of $_POST[‘_acfnonce’] is an int with the ID of the post. The error disappears if i typecast it to a string by changing line 1034 to

    if( wp_verify_nonce((string)$_POST['_acfnonce'], $nonce) ).

    This is kind of the same solution as @jurajk proposed in the previous post but it feels better to edit a plugin than WP core 🙂 It might even cause a security issue since we are validating nonces. Someone with more insight can maybe shed a light on this.

    @elliot Whether the error originates from another plugin or if it’s ACF that causes the problem in the first place I do no know but if you want some more info about my setup, I’d be happy to provide it.

    Thanks for an awesome, game changing, plugin!

  • @folbert, you are right, makes much better sense to edit the plugin. i was just too lazy to trace the error.

  • Just want to clarify that “It” in the sentence “It might even cause a security issue…” in my previous post is referring to my solution. I am not trying to make it sound like my solution is better form a security pow than the one @jurajk is suggesting.

  • I’m getting this exact same issue. First I upgraded from v4 to v5, and everything seems fine, except for this nonce-issue. I then though it had something to do with the the upgrade, so I did a fresh install of WordPress only activating acf5 PRO resulting in the same issue (hadn’t even created any field groups yet). It does go away with wp_debug set to ‘false’, but thats not really a solution.

    I dont mind editing the plugin as stated above for now. But this will only work until next update, right?

    Thank you for all your hard work Elliot!

  • Adding myself to the above, same issue is being encountered.
    Local development site, WP 4.0, ACF PRO 5.1.1.

    This only appears to happen when updating or publishing a post.

    Warning: hash_equals(): Expected user_string to be a string, integer given in /...../wp-includes/pluggable.php on line 1719
    
    Warning: hash_equals(): Expected user_string to be a string, integer given in /...../wp-includes/pluggable.php on line 1725
    
    Warning: Cannot modify header information - headers already sent by (output started at /...../wp-includes/pluggable.php:1719) in /...../wp-admin/post.php on line 233
    
    Warning: Cannot modify header information - headers already sent by (output started at /...../wp-includes/pluggable.php:1719) in /...../wp-includes/pluggable.php on line 1173
  • Seems to be fixed ith latest release this morning 🙂
    Nope. Still crashing

  • Yeah, mine is still crashing.
    I have a single relationship custom field in my example post.

  • I’m suddenly having this same issue now.

    See xdebug output in the attached screenshot.

    Let me know if you need additional info to debug.

    FYI, I’m using ACF 5.1.1

  • This is still not solved for me with latest update.

  • Hi all,

    Here’s a fix for this that doesn’t require editing the plugin or core. Since wp_verify_nonce is a pluggable function, it is overridable.

    Just add this small plugin to your mu-plugins directory and it should do the trick, at least until it’s fixed within ACF: https://gist.github.com/elcontraption/1193509457c215bfce81

    –Darin

  • Hi @folbert

    Thanks for all the info, now I understand the issue!

    I’ll have this fixed in the next version, thanks

  • Hi guys

    I’ve got a fix for the issue and if you have time, please replace the following function into the api-helpers.php file:

    
    function acf_verify_nonce( $nonce, $post_id = 0 ) {
    	
    	// vars
    	$r = false;
    	
    	
    	// note: don't reset _acfnonce here, only when $r is set to true. This solves an issue caused by other save_post actions using this function with a different $nonce
    	
    	
    	// check
    	if( isset($_POST['_acfnonce']) ) {
    
    		// verify nonce 'post|user|comment|term'
    		if( is_string($_POST['_acfnonce']) && wp_verify_nonce($_POST['_acfnonce'], $nonce) ) {
    			
    			$r = true;
    			
    			
    			// remove potential for inifinite loops
    			$_POST['_acfnonce'] = false;
    			
    		
    			// if we are currently saving a revision, allow its parent to bypass this validation
    			if( $post_id && $parent = wp_is_post_revision($post_id) ) {
    				
    				// revision: set parent post_id
    				$_POST['_acfnonce'] = $parent;
    				
    			}
    			
    		} elseif( $_POST['_acfnonce'] === $post_id ) {
    			
    			$r = true;
    			
    			// remove potential for inifinite loops
    			$_POST['_acfnonce'] = false;
    			
    		}
    		
    	}
    		
    	
    	// return
    	return $r;
    	
    }
    

    Please also let me know if this solves the issue for you

    Thanks
    E

  • Thank you Elliot,

    I updated to 5.1.2 and then replaced acf_verify_nonce() with the code in the post above. Haven’t run in to the bug since then.

  • Solves the problem too !

  • This reply has been marked as private.
Viewing 25 posts - 1 through 25 (of 26 total)

You must be logged in to reply to this topic.