• BasicPro

    (@estudio-de-grabacion)


    Hello,

    It seems there is a conflict with woocommerce when someone is trying to access a non-whitelisted endpoint without jwt-auth header.

    2020/12/09 10:47:16 [error] 22217#22217: *355452 FastCGI sent in stderr: "PHP message: PHP Warning: Illegal string offset 'slug' in /home/masteringbox.com/wp-content/plugins/woocommerce/packages/woocommerce-admin/src/API/Reports/PerformanceIndicators/Controller.php on line 149

    Additionally, I had to whitelist this endpoint ‘/wc-admin/’ for some woocommerce functionality to work.

    Not sure 100% that is not a woocommerce issue but it does not happen if I deactivate JWT-Auth

    Regards

    • This topic was modified 5 years, 4 months ago by BasicPro.
Viewing 10 replies - 1 through 10 (of 10 total)
  • same issue here
    [15-Dec-2020 08:02:08 UTC] PHP Notice: Trying to access array offset on value of type int in /home/customer/www/…..it/public_html/wp-content/plugins/woocommerce/packages/woocommerce-admin/src/API/Reports/PerformanceIndicators/Controller.php on line 149
    [15-Dec-2020 08:02:08 UTC] PHP Warning: Illegal string offset ‘slug’ in /home/customer/www/…..it/public_html/wp-content/plugins/woocommerce/packages/woocommerce-admin/src/API/Reports/PerformanceIndicators/Controller.php on line 149

    Plugin Author Bagus

    (@contactjavas)

    Hi @estudio-de-grabacion & @andrew_fisher thanks for reporting this issue,

    This wc-admin endpoint is whitelisted now in GitHub. I’ll push minor update to the plugin this week containing this fix.

    Best,
    Bagus

    Hi, same issue:

    component: “Plugin: woocommerce”
    file: “wp-content/plugins/woocommerce/packages/woocommerce-admin/src/API/Reports/PerformanceIndicators/Controller.php”
    key:
    line: 149
    message: “Illegal string offset ‘slug'”

    The warning does not show, when JWT-Auth is not activated. Whitelisting of ‘wc-admin/*’ nor ‘wc-analytics/*’ does not help.

    @estudio-de-grabacion did you manage to get rid of the warning? Would be grateful for advice.

    Hi, got it finally, what needed whitelisting next to ‘/wp-json/wc-admin/*’ was ‘/wp-json/jetpack/*’. No warnings anymore 🙂

    To Fix Warning: ‘Illegal string offset ‘slug’ . when in use JWT-Auth
    You can open directory ‘…/Controller.php’ on line ‘149’. And find to

    $endpoint[‘slug’] Replace by: $endpoint->slug

    I hope you can solve this problem…Goodluck!!!

    Hi @vigrowth,
    Did you solve the problem by changing only this line?
    or the others below as well?

    
    foreach ( $endpoints as $endpoint ) {
    			if ( '/stats' === substr( $endpoint['slug'], -6 ) ) {
    				$request  = new \WP_REST_Request( 'OPTIONS', $endpoint['path'] );
    ...
    

    Thanks

    Hi,

    I’m having the same problem, did you guys fix this issue?

    Thanks

    I am also having this issue and if you deactivate the plugin the warning goes away

    I did what @vigrowth suggested and the warning is gone but now I get a 403 header error:

    success	false
    statusCode	403
    code	"jwt_auth_no_auth_header"
    message	"Authorization header not found."
    data	[]
Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Conflict with woocommerce’ is closed to new replies.