Commit a38ba3cc by Alexander Makarov

Fixes #4526: fixed error caused by substr_compare length parameter doesn't accept null in PHP 5.4

parent c6e8f5a6
......@@ -374,7 +374,7 @@ class Generator extends \yii\gii\Generator
$labels[$name] = 'ID';
} else {
$label = Inflector::camel2words($name);
if (!empty($label) && substr_compare($label, ' id', -3, null, true) === 0) {
if (!empty($label) && substr_compare($label, ' id', -3, 3, true) === 0) {
$label = substr($label, 0, -3) . ' ID';
}
$labels[$name] = $label;
......
......@@ -197,7 +197,7 @@ class Generator extends \yii\gii\Generator
$labels[$column->name] = 'ID';
} else {
$label = Inflector::camel2words($column->name);
if (!empty($label) && substr_compare($label, ' id', -3, null, true)) {
if (!empty($label) && substr_compare($label, ' id', -3, 3, true)) {
$label = substr($label, 0, -3) . ' ID';
}
$labels[$column->name] = $label;
......@@ -429,7 +429,7 @@ class Generator extends \yii\gii\Generator
*/
protected function generateRelationName($relations, $className, $table, $key, $multiple)
{
if (!empty($key) && substr_compare($key, 'id', -2, null, true) === 0 && strcasecmp($key, 'id')) {
if (!empty($key) && substr_compare($key, 'id', -2, 2, true) === 0 && strcasecmp($key, 'id')) {
$key = rtrim(substr($key, 0, -2), '_');
}
if ($multiple) {
......
......@@ -183,7 +183,7 @@ class Generator extends \yii\gii\Generator
$label = 'ID';
} else {
$label = Inflector::camel2words($attribute);
if (substr_compare($label, ' id', -3, null, true) === 0) {
if (substr_compare($label, ' id', -3, 3, true) === 0) {
$label = substr($label, 0, -3) . ' ID';
}
}
......
......@@ -181,7 +181,7 @@ class Generator extends \yii\gii\Generator
$labels[$column->name] = 'ID';
} else {
$label = Inflector::camel2words($column->name);
if (substr_compare($label, ' id', -3, null, true) === 0) {
if (substr_compare($label, ' id', -3, 3, true) === 0) {
$label = substr($label, 0, -3) . ' ID';
}
$labels[$column->name] = $label;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment