Announcement

Collapse
No announcement yet.

PHP error in the logs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP error in the logs

    Hi,

    How to identify / find the plugin that gives the following PHP (7.4.19) error under vB5?

    Under vB3 & vB4, this plugin helps a lot but there is no vB5 version.

    Code:
    [25-Aug-2021 02:49:49 UTC] PHP Warning: Use of undefined constant userid - assumed 'userid' (this will throw an Error in a future version of PHP) in /home/xxxxxx/public_html/xxxxxx/includes/vb5/template.php(399) : eval()'d code on line 296
    Best Regards

  • #2
    I replaced userid with 'userid' in several templates related to suspected plugins but the error is not fixed yet. I will deactivate all the plugins and reactivate them one by one.

    Comment


    • #3
      It is a Warning and shouldn't actually affect the operation of the software as long as you're not using PHP 8.X. The warning appears to be coming from template code but the specific template isn't specified. There is no way to know the exact line of code that is causing this warning on your system.

      I can't seem to recreate it. I suspect that it is from a custom template. Unless you know what was happening at the time the warning occurred, it will be difficult to track down. Make sure your templates use the vbulletin dot (.) notation for arrays. For example currentuser.userid instead of $currentuser['userid'] or the invalid $currentuser[userid]. This should allow the template parser to properly escape any variables.
      Translations provided by Google.

      Wayne Luke
      The Rabid Badger - a vBulletin Cloud demonstration site.
      vBulletin 5 API

      Comment


      • #4
        I removed the following code in config.php and the error appears in the postbit. However the plugin is disabled and the cache is cleared.

        error_reporting(0);
        @ini_set('display_errors', 0);
        error_reporting(E_ALL ^ E_NOTICE);

        I suspect that it is from a custom template. Unless you know what was happening at the time the warning occurred, it will be difficult to track down. Make sure your templates use the vbulletin dot (.) notation for arrays. For example currentuser.userid instead of $currentuser['userid'] or the invalid $currentuser[userid]. This should allow the template parser to properly escape any variables.
        Yes, it's a custom template related to this topic. The template conversation_userinfo and the horizontal postbit works fine but it is an annoying error.

        It is a Warning and shouldn't actually affect the operation of the software as long as you're not using PHP 8.X.
        OK. I can live with this up to PHP version 8.

        Thank you very much

        Comment


        • #5
          I would have to see the code that you are using to try and understand what is going on.
          Translations provided by Google.

          Wayne Luke
          The Rabid Badger - a vBulletin Cloud demonstration site.
          vBulletin 5 API

          Comment


          • #6
            It's not my code, im not a coder but I play often with the codes of the coders to go further and often it works.

            In this case, by removing the following line of code, the error disappears. I tested and it's fixed, the conversation_userinfo template is working fine now in the horizontal postbit so I can continue to customize the horizontal postbit.

            Code:
            {vb:data posterInfo, user, fetchUserinfo, {vb:raw conversation['userid']}}
            Thank you very much for your offer.
            Best Regards

            Comment


            • #7
              Change conversation['userid'] to conversation.userid
              Translations provided by Google.

              Wayne Luke
              The Rabid Badger - a vBulletin Cloud demonstration site.
              vBulletin 5 API

              Comment


              • #8
                Originally posted by Wayne Luke View Post
                Change conversation['userid'] to conversation.userid
                Thanks, I'll try that but one line down after my conditionals, I have the following line of code, I guess it replaces the previous line.
                {vb:rawdata userInfo, user, fetchProfileInfo, {vb:raw userInfo.userid}}
                I think my problem is solved now and I am glad.

                Comment


                • #9
                  Originally posted by Wayne Luke View Post
                  Change conversation['userid'] to conversation.userid
                  This change works perfectly, the error message is no longer shown on the screen or in the logs.

                  Comment

                  Related Topics

                  Collapse

                  Working...
                  X