Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CArrayDataProvider cast sort field to strlower issue #4573

Open
sveneld opened this issue Dec 4, 2024 · 0 comments
Open

CArrayDataProvider cast sort field to strlower issue #4573

sveneld opened this issue Dec 4, 2024 · 0 comments

Comments

@sveneld
Copy link

sveneld commented Dec 4, 2024

Deprecated: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/yiisoft/yii/framework/web/CArrayDataProvider.php on line 179

protected function getSortingFieldValue($data, $fields)
	{
		if(is_object($data))
		{
			foreach($fields as $field)
				$data=isset($data->$field) ? $data->$field : null;
		}
		else
		{
			foreach($fields as $field)
				$data=isset($data[$field]) ? $data[$field] : null;
		}
		return $this->caseSensitiveSort ? $data : mb_strtolower($data,Yii::app()->charset);
	}

What steps will reproduce the problem?

If your dataprovider have a field with null value and caseSensitiveSort = false you will have a notice due to the casting $data to string

What is the expected result?

No deprecation notice

What do you get instead?

deprecation notice

Additional info

Q A
Yii version 1.1.29
PHP version 8.1
Operating system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants