• Resolved JiveDig

    (@jivedig)


    First off, great plugin, thanks! Super useful for sites where comments are important (and heavily used).

    However, i’m seeing this error when logged in as a Subscriber, Author or a user with no role (via User Switching plugin). It worked when Editor or Admin.

    
    Whoops\Exception\ErrorException: Undefined offset: 1 in file /home/jcole010/domains/dev.balloon-juice.com/public_html/wp-content/plugins/thoughtful-comments/fv-thoughtful-comments.php on line 1153
    Stack trace:
      1. Whoops\Exception\ErrorException->() /home/jcole010/domains/dev.balloon-juice.com/public_html/wp-content/plugins/thoughtful-comments/fv-thoughtful-comments.php:1153
      2. Whoops\Run->handleError() /home/jcole010/domains/dev.balloon-juice.com/public_html/wp-content/plugins/thoughtful-comments/fv-thoughtful-comments.php:1153
      3. fv_tc->comment_links_replace_2() [internal]:0
      4. preg_replace_callback() /home/jcole010/domains/dev.balloon-juice.com/public_html/wp-content/plugins/thoughtful-comments/fv-thoughtful-comments.php:1195
      5. fv_tc->comment_links() /home/jcole010/domains/dev.balloon-juice.com/public_html/wp-includes/class-wp-hook.php:288
    
    • This topic was modified 5 years, 6 months ago by JiveDig.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter JiveDig

    (@jivedig)

    I took this line:

    
    function comment_links_replace_2( $link ) {
    	preg_match( '~href=["\'](.*?)["\']~', $link[0], $href );
    	preg_match( '~>(.*?)</a>~', $link[0], $text );
    	if( $href[1] == $text[1] ) {
    

    And added a check here:

    
    function comment_links_replace_2( $link ) {
    	preg_match( '~href=["\'](.*?)["\']~', $link[0], $href );
    	preg_match( '~>(.*?)</a>~', $link[0], $text );
    	if( ! isset( $href[1] ) || ! isset( $text[1] ) ) {
    		return $link[0];
    	}
    	if( $href[1] == $text[1] ) {
    

    And the error goes away.

    Thread Starter JiveDig

    (@jivedig)

    Submitted PR. Let me know if you’re interested in merging this, otherwise I need to come up with another solution. https://github.com/foliovision/thoughtful-comments/pull/36

    Thread Starter JiveDig

    (@jivedig)

    Just found the official source of what caused it to break. This site had a comment with some broken/malformed HTML. I edited/fixed the comment and the issue went away. Still seems like it’d be safe to add the isset checks but the error is gone at least.

    I’ll close this, but feel free to merge the PR. Thanks.

    Hello JiveDig,

    thank you for the PR!

    I actually prefer the version with ||. I made your fix part of both the master and dev versions to make sure it’s part of the plugin.

    Thanks,
    Martin

    Thread Starter JiveDig

    (@jivedig)

    ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error when logged in as subscriber, author, or no role’ is closed to new replies.