• Resolved patrickhait

    (@patrickhait)


    Hello, I have WP 4.7.1 and am trying to use PHP 7.0, but am having some difficulty. My PHP error logs show: Illegal string offset 'name' in /home/.../public_html/wp-content/plugins/members-list/class/members.php on line 432 The plugin does not work.
    When I drop down to PHP 5.6, the plugin works, but in the error log, I get PHP Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in /home/.../public_html/wp-content/plugins/members-list/class/members.php on line 450
    It seems like a mysqli type thing, but I’m not sure. Is there any update that can be made to make it compatible with PHP7 and WP 471?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author ternstyle

    (@mpraetzel)

    I can fix the 5.6 error for you!

    Change the sanitize function on line 642 of /class/members.php to the following:

    function sanitize($s) {
    		// to be used in future updates
    		$p = new PDO('mysql:dbname='.DB_NAME.';host='.DB_HOST,DB_USER,DB_PASSWORD);
    		return substr($p->quote($s),1,strlen($p->quote($s))-2);
    	}

    As far as the first error goes, what does your shortcode look like?

    Thread Starter patrickhait

    (@patrickhait)

    When I view the page using PHP7, I see the entire page Except for the list of members… I see the alphabet where I can select the letter for the listing, but I cannot see any members.

    Note: When I switch back to PHP5.6, all works well. I want to go over to PHP7 though!

    Are there any plans to fix that function for ‘Illegal String Offset’?

    Thread Starter patrickhait

    (@patrickhait)

    Thanks for getting rid of the errors in PHP 5.6!
    I replaced the sanitize function what was on line 448-450 with the code that you suggested.

    However, the same behavior displayed itself when I tried out PHP 7 again. No list, and several instances of “Illegal string offset ‘name’ — 432″ in the php error log.

    Edit: Strange — It thinks it’s displaying #1-5 .. and then when I go to the next page #6-11, and it even leaves blank space for them (Under PHP7), but nothing is displayed.

    My Shortcode is: [members-list list=”” search=true alpha=true pagination=true pagination2=true sort=true radius=false]

    • This reply was modified 7 years, 10 months ago by patrickhait. Reason: more details
    • This reply was modified 7 years, 10 months ago by patrickhait.
    • This reply was modified 7 years, 10 months ago by patrickhait. Reason: updated shortcode
    • This reply was modified 7 years, 10 months ago by patrickhait.
    • This reply was modified 7 years, 10 months ago by patrickhait.
    Thread Starter patrickhait

    (@patrickhait)

    So Sorry! You can mark this ‘probably’ solved .. I was stuck on an old version 3.6.3. I tested the plugin on another site and saw that it worked on PHP7. It was a change that I made a long time ago and forgot that I didn’t allow the upgrade to happen. Thank you for your assistance.

    Plugin Author ternstyle

    (@mpraetzel)

    Excellent! Glad everything worked out.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Illegal string offset ‘name’’ is closed to new replies.