Support » Plugin: Pantheon Advanced Page Cache » Too few arguments error in send_headers function panthon-page-cache.php

  • Resolved akshaykelotra

    (@akshaykelotra)


    Uncaught ArgumentCountError: Too few arguments to function WP_REST_Server::send_header(), 1 passed in /wp-content/mu-plugins/pantheon/pantheon-page-cache.php on line 289 and exactly 2 expected in /wp-includes/rest-api/class-wp-rest-server.php:1239

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Hi @akshaykelotra,

    Thanks for the report. The error is actually related to the Pantheon WordPress upstream, not Pantheon Advanced Page Cache.

    With this being said, I see two arguments passed to $server->send_header() in the call here: https://github.com/pantheon-systems/WordPress/blob/501b054362d51487adc88515a3ea6c8e84df749b/wp-content/mu-plugins/pantheon/pantheon-page-cache.php#L289 It’s the same line as reported in your error message.

    Can you take a look at your codebase to see whether it differs in some way? I’m not sure why you might be experiencing this error message.

    akshaykelotra

    (@akshaykelotra)

    Hello Daniel(@danielbachhuber),

    Thanks for your reply. I checked my codebase and the send_header function from me have only one parameter. Here is the code which I have in our code base.
    $server->send_header( 'cache-control: public, max-age=' . $ttl . ' s-maxage=2592000' );

    Just to confirm that on my dashboard I am not getting any message that this plugin is out dated. Let me know if I should replace this line of code with the git repo code on my site.

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Hi @akshaykelotra:

    I checked my codebase and the send_header function from me have only one parameter.

    Interesting. Someone must’ve modified the code at some point. You’ll want to change that code to pass the header as two arguments:

    
    $server->send_header( 'Cache-Control', 'public, max-age=' . $ttl . ', s-maxage=2592000' );
    

    Once you do so, the error should no longer appear.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Too few arguments error in send_headers function panthon-page-cache.php’ is closed to new replies.