title: Upgraded to php 8.1 now getting "PHP Deprecated: addslashes()"
body: <p>I just upgraded to php 8.1 from 7.3 and going through to resolve a handful of stuff that broke.  One message that pops up is &quot;PHP Deprecated:  addslashes()&quot;.  We use the command quite a bit, and it's not to prevent mysql injections.  We have to deal with names that could have special characters in them ' ~ etc.</p>
  <p>But when I check out <a href="https://www.php.net/manual/en/function.addslashes.php" rel="nofollow noreferrer">https://www.php.net/manual/en/function.addslashes.php</a>
  it says that it is supported in PHP8.</p>
  <p>Sorry, I guess the newb in me... but what am I missing?
  If it's out, ok, what is the supported way for dealing with it now?</p>
  <p><strong>Update to add code example and question clarification</strong></p>
  <p>Now that I've slept on it, I see it's not a deprecation error on addslashes(). It's an error saying that the value that we are passing into the function is NULL.  And I see in the docs this is no longer allowed as of 8.1.</p>
  <p>So based on that information what is the new and improved way handle the example below.</p>
  <pre><code>$(function () {
  $('.adminheader').html('&lt;?php addslashes(GetMainEventNames()); ?&gt;');
  $('.maineventbuttons').button().each(function () {
    var MainEventCode = $(this).attr('data-code');
            $(this).click(function () {
              ChangeLocalActiveStatus(MainEventCode);
            });
        });
  </code></pre>
  <p><strong>Error Message</strong></p>
  <pre><code>PHP Deprecated:  addslashes(): Passing null to parameter #1 ($string) of type string is deprecated in....
  </code></pre>