php - 严格标准 :Only variables should be passed by reference is

标签 php mysql

严格标准:仅应在/home/zumpu/public_html/cats/cats-0.8.0/lib/DataGrid.php 第 1519 行中通过引用传递变量

严格标准:仅应在/home/zumpu/public_html/cats/cats-0.8.0/lib/DataGrid.php 第 1535 行中通过引用传递变量

if ($sizable)
            {
                $formatString = '<th align="left" class="resizeableCell" '
                    . 'style="width:5px; border-collapse: collapse; '
                    . '-moz-user-select: none; -khtml-user-select: none;';

               if (end(array_keys($this->_currentColumns)) != $index) //line 1519
               {
                   //Uncomment for gray resize bars
                   $formatString .= 'border-right:1px solid gray;';
               }

                $formatString .=
                      'user-select: none;" onmouseover="style.cursor = '
                    . '\'e-resize\'" onmousedown="startResize(\'cell%s%s\', '
                    . '\'table%s\', \'cell%s%s\', %s, \'%s\', \'%s\', '
                    . '\'%s\', \'%s\', this.offsetWidth);">';

                echo sprintf(
                    $formatString,
                    $md5InstanceName, $index,
                    $md5InstanceName,
                    $md5InstanceName, end(array_keys($this->_currentColumns)),// line 1535
                    $this->_tableWidth,
                    urlencode($this->_instanceName),
                    $_SESSION['CATS']->getCookie(),
                    $data['name'],
                    implode(',', $cellIndexes)
                );

                echo '<div class="dataGridResizeAreaInnerDiv"></div></th>', "\n";
            }
        }

帮帮我,我被困了两天

最佳答案

严格来说,您不应该将函数的返回值直接传递给另一个将其参数作为引用的函数,而无需先将其分配给命名变量。

无论如何,它通常都可以工作,并且可能不会中断,[直到 PHP 版本更改破坏它],但由于这些原因,它会生成 E_STRICT 消息。

这应该删除该消息,但保留当前功能:

            $keys = array_keys($this->_currentColumns);

            if (end($keys)) != $index) //line 1519

            /* ... */

            echo sprintf(
                $formatString,
                $md5InstanceName, $index,
                $md5InstanceName,
                $md5InstanceName, end($keys),// line 1535
                $this->_tableWidth,
                urlencode($this->_instanceName),
                $_SESSION['CATS']->getCookie(),
                $data['name'],
                implode(',', $cellIndexes)
            );

关于php - 严格标准 :Only variables should be passed by reference is,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22700749/

相关文章:

php - CASE 更新的 SQL 条件

mysql - 如何从mysql数据库中获取倒数第二行?

php - 插入到两个表中,一个具有另一个的外键

php - 删除记录返回 SQLSTATE[42000] 错误

PHP 未以正确的格式导出 MySQL 数据库

php - (mysql, php) 如何在插入数据前获取 auto_increment 字段值?

mysql - 1064 mysql 使用@时出错

mysql查询将字符串与int值进行比较

php - 在字符串中包含单引号

php - 方法 whereHas 不存在