Since a upgrade to PHP 8.1 from 7.4 we are getting this error in an application:
Error message: Deprecated Functionality: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /Model/Plugin/Order.php on line 33
Line 33 is a IF-statement
33. if (strpos($orderStatus, '_') !== false) {
34. do stuff...
35. }
Is it possible to change it in someway to be able to handle null values?
Thanks,
Related
I am trying to setup my CakePHP project on a localhost environment, but i get this error:
Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in C:\xampp\htdocs\Bakesystem\vendor\cakephp\cakephp\src\Utility\Text.php on line 232
Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in C:\xampp\htdocs\Bakesystem\vendor\cakephp\cakephp\src\Utility\Text.php on line 232
Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in C:\xampp\htdocs\Bakesystem\vendor\cakephp\cakephp\src\Utility\Text.php on line 232
Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in C:\xampp\htdocs\Bakesystem\vendor\cakephp\cakephp\src\Utility\Text.php on line 232
Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in C:\xampp\htdocs\Bakesystem\vendor\cakephp\cakephp\src\Utility\Text.php on line 232
And then i get like 30 of these errors...
After all these errors gets printed out, the rest displays fine. I can obviously toggle errors off and keep going, but i would like to fix the error if possible.
Can anyone direct me to anything that might help me? I'm kinda lost as to how i can debug this and resolve it...
I receive these errors Please help me
Warning
: date_diff() expects parameter 1 to be DateTimeInterface, boolean given in
on line
72
Fatal error
: Uncaught Error: Call to a member function format() on boolean in ___ Stack trace: #0 {main} thrown in
on line
73
here's my code
date_create() is failing to create a date and it is returning FALSE rather than a DateTimeInterface. Hence the error, expects parameter 1 to be DateTimeInterface, boolean given. Double check your posted value to see that it is usable.
date_diff() returns false and causes the next error.
I have some code that looks exactly like this:
$result = $client->getObject(array(
'Bucket' => $bucket,
'Key' => 'data.txt',
'SaveAs' => '/tmp/data.txt'
));
its one of the examples listed here: http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.S3.S3Client.html#_getObject
unfortunately I get this fatal error:
PHP Warning: Missing argument 2 for AmazonS3::get_object() in /var/www/CronJobs/aws-sdk- for-php/services/s3.class.php on line 1489
PHP Notice: Undefined variable: filename in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1495
PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1042
PHP Warning: preg_match() expects parameter 2 to be string, array given in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1043
PHP Notice: Array to string conversion in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 548
PHP Fatal error: Uncaught exception 'S3_Exception' with message 'S3 does not support "Array" as a valid bucket name. Review "Bucket Restrictions and Limitations" in the S3 Developer Guide for more information.' in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php:548
Stack trace:
0 /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php(1530): AmazonS3->authenticate(Array, Array)
1 [internal function]: AmazonS3->get_object(Array)
2 /var/www/CronJobs/aws-sdk-for-php/sdk.class.php(436): call_user_func_array(Array, Array)
3 /var/www/CronJobs/leefomatic/index.php(70): CFRuntime->__call('getObject', Array)
4 /var/www/CronJobs/leefomatic/index.php(70): AmazonS3->getObject(Array)
5 {main}
thrown in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 548
in my script I am currently listObject, copy_object and delete_option just fine. Any thoughts as to why a fatal error comes up on a getObject?
Thanks.
It looks like you are using the SDK 2.x documentation with SDK 1.x code. The filenames (e.g., s3.class.php, sdk.class.php) output in the error block you have shown definitely indicate that you are using SDK 1.x code. You either need to install the newer and better supported SDK 2.x (here are some instructions), or use the SDK 1.x docs.
I've just got an error.
When I try to assign an object like this: am doing for SEO by google php seo scripts.
Deprecated: Assigning the return value of new by reference is deprecated in E:\wamp\www\subgoogle\nusoap.php on line 3703
Deprecated: Function ereg() is deprecated in E:\wamp\www\subgoogle\nusoap.php on line 3876
Deprecated: Function ereg() is deprecated in E:\wamp\www\subgoogle\nusoap.php on line 3896
Deprecated: Function ereg() is deprecated in E:\wamp\www\subgoogle\nusoap.php on line 1451
Notice: Uninitialized string offset: 0 in E:\wamp\www\subgoogle\searchgoosimple.php on line 89
Sorry, no search results found
The error I get is "Assigning the return value of new by reference is deprecated". Actually I've been looking for a solution but the only one I've seen is just turn down the politicy of nusoap.php (error_reporting). I've tried it too, but it didn't work.
It's so confusing..I hope you could help me. Thanks in advance.
Each of these error messages carries a line number and a filename:
Deprecated: Assigning the return value of new by reference is deprecated in E:\wamp\www\subgoogle\nusoap.php on line 3703
Go there, and remove the & before the new.
To get rid of the other warnings, use following setting in your main script to reduce the error reporting level:
error_reporting(E_ALL);
You'll have to find eventual other instances of error_reporting( and adapt them too.
I work with DbSimple in my site-engine. Everything worked fine but some time ago I began to get an error:
Deprecated: Assigning the return value of new by reference is deprecated in Z:\home\localhost\www\ololo\DbSimple\Generic.php on line 113
Deprecated: Assigning the return value of new by reference is deprecated in Z:\home\localhost\www\ololo\DbSimple\Generic.php on line 133
Deprecated: Assigning the return value of new by reference is deprecated in Z:\home\localhost\www\ololo\DbSimple\Mysql.php on line 73
Warning: call_user_func() expects parameter 1 to be a valid callback, function 'mysqlErrorHandler' not found or invalid function name in Z:\home\localhost\www\ololo\DbSimple\Generic.php on line 1278
SELECT * FROM `configuration`
NULL
What can it be?
My guess is that you upgraded PHP from 5.2.x to 5.3. I've seen similar issues with Joomla.
EDIT:
Deprecated features in PHP 5.3.x