Upgrade from PHP 7.0 to PHP 7.1. Fatal error: Only variables can be passed by reference - $string get_param...












0















We are a tennis and squash club running nBill, an invoicing system that is no longer actively supported. I nursed it on upgrade from PHP 5 to 7 but on further upgrading to PHP7.1 the application does not load and I get the following fatal error message:



Fatal error: Only variables can be passed by reference in /xxxxxxxx/public_html/administrator/components/com_nbill/classes/base/data_mapper.php on line 98.


I understand what is wrong but I cannot solve it, it is beyond my limited knowledge of PHP. Removing the section of code enables the application to work and then it seems to work fine.



The statement at fault is:



  $string = nbf_common::get_param(array($key=>$value), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


The full section of code reads:



     * Return an appropriate string to use for the value in an SQL statement
(escaped, or intval'd as appropriate for the data type, based on the XML

schema file, if found, or just treated as a string [and escaped] otherwise)

* @param string $key Column name
* @param mixed $value Literal value
*/
protected function getValueSqlString($key, $value)
{
$string = "";

if ($this->schema)
{
$col = $schema->xpath("columns/column[@name='$key']");
switch (@$col->type)
{
case "int":
case "tinyint":
case "smallint":
case "mediumint":
case "bigint":
case "integer":
case "long":
$string = strval(intval($value));
break;
default:
$string = nbf_common::get_param(array($key=>$value),
$key, '', false, (string)@$col[0]->encode_html != "false",
(string)@$col[0]->allow_html == "true",
(string)@$col[0]->allow_html == "true");
break;
}
}

if (!$string) {
$string = "'" . $this->db->getEscaped($value) . "'";
}
return $string;
}

/**


Any help most gratefully received. Note we are actively seeking a replacement invoicing system and are trialling CBSubs.



CBSheen










share|improve this question





























    0















    We are a tennis and squash club running nBill, an invoicing system that is no longer actively supported. I nursed it on upgrade from PHP 5 to 7 but on further upgrading to PHP7.1 the application does not load and I get the following fatal error message:



    Fatal error: Only variables can be passed by reference in /xxxxxxxx/public_html/administrator/components/com_nbill/classes/base/data_mapper.php on line 98.


    I understand what is wrong but I cannot solve it, it is beyond my limited knowledge of PHP. Removing the section of code enables the application to work and then it seems to work fine.



    The statement at fault is:



      $string = nbf_common::get_param(array($key=>$value), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


    The full section of code reads:



         * Return an appropriate string to use for the value in an SQL statement
    (escaped, or intval'd as appropriate for the data type, based on the XML

    schema file, if found, or just treated as a string [and escaped] otherwise)

    * @param string $key Column name
    * @param mixed $value Literal value
    */
    protected function getValueSqlString($key, $value)
    {
    $string = "";

    if ($this->schema)
    {
    $col = $schema->xpath("columns/column[@name='$key']");
    switch (@$col->type)
    {
    case "int":
    case "tinyint":
    case "smallint":
    case "mediumint":
    case "bigint":
    case "integer":
    case "long":
    $string = strval(intval($value));
    break;
    default:
    $string = nbf_common::get_param(array($key=>$value),
    $key, '', false, (string)@$col[0]->encode_html != "false",
    (string)@$col[0]->allow_html == "true",
    (string)@$col[0]->allow_html == "true");
    break;
    }
    }

    if (!$string) {
    $string = "'" . $this->db->getEscaped($value) . "'";
    }
    return $string;
    }

    /**


    Any help most gratefully received. Note we are actively seeking a replacement invoicing system and are trialling CBSubs.



    CBSheen










    share|improve this question



























      0












      0








      0








      We are a tennis and squash club running nBill, an invoicing system that is no longer actively supported. I nursed it on upgrade from PHP 5 to 7 but on further upgrading to PHP7.1 the application does not load and I get the following fatal error message:



      Fatal error: Only variables can be passed by reference in /xxxxxxxx/public_html/administrator/components/com_nbill/classes/base/data_mapper.php on line 98.


      I understand what is wrong but I cannot solve it, it is beyond my limited knowledge of PHP. Removing the section of code enables the application to work and then it seems to work fine.



      The statement at fault is:



        $string = nbf_common::get_param(array($key=>$value), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


      The full section of code reads:



           * Return an appropriate string to use for the value in an SQL statement
      (escaped, or intval'd as appropriate for the data type, based on the XML

      schema file, if found, or just treated as a string [and escaped] otherwise)

      * @param string $key Column name
      * @param mixed $value Literal value
      */
      protected function getValueSqlString($key, $value)
      {
      $string = "";

      if ($this->schema)
      {
      $col = $schema->xpath("columns/column[@name='$key']");
      switch (@$col->type)
      {
      case "int":
      case "tinyint":
      case "smallint":
      case "mediumint":
      case "bigint":
      case "integer":
      case "long":
      $string = strval(intval($value));
      break;
      default:
      $string = nbf_common::get_param(array($key=>$value),
      $key, '', false, (string)@$col[0]->encode_html != "false",
      (string)@$col[0]->allow_html == "true",
      (string)@$col[0]->allow_html == "true");
      break;
      }
      }

      if (!$string) {
      $string = "'" . $this->db->getEscaped($value) . "'";
      }
      return $string;
      }

      /**


      Any help most gratefully received. Note we are actively seeking a replacement invoicing system and are trialling CBSubs.



      CBSheen










      share|improve this question
















      We are a tennis and squash club running nBill, an invoicing system that is no longer actively supported. I nursed it on upgrade from PHP 5 to 7 but on further upgrading to PHP7.1 the application does not load and I get the following fatal error message:



      Fatal error: Only variables can be passed by reference in /xxxxxxxx/public_html/administrator/components/com_nbill/classes/base/data_mapper.php on line 98.


      I understand what is wrong but I cannot solve it, it is beyond my limited knowledge of PHP. Removing the section of code enables the application to work and then it seems to work fine.



      The statement at fault is:



        $string = nbf_common::get_param(array($key=>$value), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


      The full section of code reads:



           * Return an appropriate string to use for the value in an SQL statement
      (escaped, or intval'd as appropriate for the data type, based on the XML

      schema file, if found, or just treated as a string [and escaped] otherwise)

      * @param string $key Column name
      * @param mixed $value Literal value
      */
      protected function getValueSqlString($key, $value)
      {
      $string = "";

      if ($this->schema)
      {
      $col = $schema->xpath("columns/column[@name='$key']");
      switch (@$col->type)
      {
      case "int":
      case "tinyint":
      case "smallint":
      case "mediumint":
      case "bigint":
      case "integer":
      case "long":
      $string = strval(intval($value));
      break;
      default:
      $string = nbf_common::get_param(array($key=>$value),
      $key, '', false, (string)@$col[0]->encode_html != "false",
      (string)@$col[0]->allow_html == "true",
      (string)@$col[0]->allow_html == "true");
      break;
      }
      }

      if (!$string) {
      $string = "'" . $this->db->getEscaped($value) . "'";
      }
      return $string;
      }

      /**


      Any help most gratefully received. Note we are actively seeking a replacement invoicing system and are trialling CBSubs.



      CBSheen







      php joomla3.0






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 13:23









      Oleg Nurutdinov

      356213




      356213










      asked Nov 13 '18 at 10:10









      tenniswallytenniswally

      32




      32
























          2 Answers
          2






          active

          oldest

          votes


















          1














          <?php
          $array = array($key=>$value);
          $string = nbf_common::get_param(strtolower(array_pop($array)), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


          Try the above code. I am not a joomla expert but based on your error i think the problem is when you try to pass an array inside the get_param function.






          share|improve this answer
























          • Brilliant. Works a treat. Can't say how grateful I am. Many thanks

            – tenniswally
            Nov 13 '18 at 12:53





















          0














          nbf_common::get_param()



          Look this function up, see which of the params is passed by reference, then check if the value actually passed as that parameter can be passed as reference. It is probably what pr1nc3 says.






          share|improve this answer
























          • Many thanks for responding. As you suggested the answer from princ3 works.

            – tenniswally
            Nov 13 '18 at 12:55











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278592%2fupgrade-from-php-7-0-to-php-7-1-fatal-error-only-variables-can-be-passed-by-re%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          <?php
          $array = array($key=>$value);
          $string = nbf_common::get_param(strtolower(array_pop($array)), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


          Try the above code. I am not a joomla expert but based on your error i think the problem is when you try to pass an array inside the get_param function.






          share|improve this answer
























          • Brilliant. Works a treat. Can't say how grateful I am. Many thanks

            – tenniswally
            Nov 13 '18 at 12:53


















          1














          <?php
          $array = array($key=>$value);
          $string = nbf_common::get_param(strtolower(array_pop($array)), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


          Try the above code. I am not a joomla expert but based on your error i think the problem is when you try to pass an array inside the get_param function.






          share|improve this answer
























          • Brilliant. Works a treat. Can't say how grateful I am. Many thanks

            – tenniswally
            Nov 13 '18 at 12:53
















          1












          1








          1







          <?php
          $array = array($key=>$value);
          $string = nbf_common::get_param(strtolower(array_pop($array)), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


          Try the above code. I am not a joomla expert but based on your error i think the problem is when you try to pass an array inside the get_param function.






          share|improve this answer













          <?php
          $array = array($key=>$value);
          $string = nbf_common::get_param(strtolower(array_pop($array)), $key, '', false, (string)@$col[0]->encode_html != "false", (string)@$col[0]->allow_html == "true", (string)@$col[0]->allow_html == "true");


          Try the above code. I am not a joomla expert but based on your error i think the problem is when you try to pass an array inside the get_param function.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 10:17









          pr1nc3pr1nc3

          3,9042621




          3,9042621













          • Brilliant. Works a treat. Can't say how grateful I am. Many thanks

            – tenniswally
            Nov 13 '18 at 12:53





















          • Brilliant. Works a treat. Can't say how grateful I am. Many thanks

            – tenniswally
            Nov 13 '18 at 12:53



















          Brilliant. Works a treat. Can't say how grateful I am. Many thanks

          – tenniswally
          Nov 13 '18 at 12:53







          Brilliant. Works a treat. Can't say how grateful I am. Many thanks

          – tenniswally
          Nov 13 '18 at 12:53















          0














          nbf_common::get_param()



          Look this function up, see which of the params is passed by reference, then check if the value actually passed as that parameter can be passed as reference. It is probably what pr1nc3 says.






          share|improve this answer
























          • Many thanks for responding. As you suggested the answer from princ3 works.

            – tenniswally
            Nov 13 '18 at 12:55
















          0














          nbf_common::get_param()



          Look this function up, see which of the params is passed by reference, then check if the value actually passed as that parameter can be passed as reference. It is probably what pr1nc3 says.






          share|improve this answer
























          • Many thanks for responding. As you suggested the answer from princ3 works.

            – tenniswally
            Nov 13 '18 at 12:55














          0












          0








          0







          nbf_common::get_param()



          Look this function up, see which of the params is passed by reference, then check if the value actually passed as that parameter can be passed as reference. It is probably what pr1nc3 says.






          share|improve this answer













          nbf_common::get_param()



          Look this function up, see which of the params is passed by reference, then check if the value actually passed as that parameter can be passed as reference. It is probably what pr1nc3 says.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 10:36









          minitaurosminitauros

          849615




          849615













          • Many thanks for responding. As you suggested the answer from princ3 works.

            – tenniswally
            Nov 13 '18 at 12:55



















          • Many thanks for responding. As you suggested the answer from princ3 works.

            – tenniswally
            Nov 13 '18 at 12:55

















          Many thanks for responding. As you suggested the answer from princ3 works.

          – tenniswally
          Nov 13 '18 at 12:55





          Many thanks for responding. As you suggested the answer from princ3 works.

          – tenniswally
          Nov 13 '18 at 12:55


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278592%2fupgrade-from-php-7-0-to-php-7-1-fatal-error-only-variables-can-be-passed-by-re%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Lugert, Oklahoma