Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Line 427 in uc_wishlist.module is not calling substr with the right parameters.
427: if (!substr(request_uri(), 'wishlist', -4)) {
warning: substr() expects parameter 2 to be long, string given in C:\XAMPP\xampp\htdocs\drupal\modules\uc_subscription\uc_subscription.module on line 427.
Proper Usage:
string substr ( string $string , int $start [, int $length ] )
Basically substr is expecting an integer and it's getting the string 'wishlist'.
Comment | File | Size | Author |
---|---|---|---|
#10 | 0001-902028-Problem-with-substr-in-uc_wishlist.module.patch | 868 bytes | Scott Robertson |
Comments
Comment #1
funjay CreditAttribution: funjay commentedComment #2
holljac CreditAttribution: holljac commentedI have the same issue. Is there a fix?
Comment #3
shout CreditAttribution: shout commentedI can confirm the same issue...
warning: substr() expects parameter 2 to be long, string given in ...\ubercart\uc_wishlist\uc_wishlist.module on line 420.
Comment #4
jerry CreditAttribution: jerry commentedSubscribing.
Comment #5
MustangGB CreditAttribution: MustangGB commentedGetting this also
I'm not sure when this message is intended for display
So no idea how to fix it
Comment #6
sibiru CreditAttribution: sibiru commentedI just remark the line like this and problem solved
..................
...................
//edit by azul
//if (!substr(request_uri(), 'wishlist', -4)) {
drupal_set_message(t('Your item(s) have been updated.'));
//}
//edit by azul
.............
................
Comment #7
MustangGB CreditAttribution: MustangGB commentedYes it will solve the problem of the warning appearing
But, as i mentioned previously, it doesn't solve the problem of when the message should be displayed
As now it will always be displayed, which wasn't the intention
Comment #8
BigMike CreditAttribution: BigMike commentedI know this hasn't been posted to in over 1 year, but I have this error and am wondering if anyone has resolved this yet?
warning: substr() expects parameter 2 to be long, string given in /....../uc_wishlist/uc_wishlist.module on line 416.
Here is what my file near line 416 looks like. I am using UC Wish List 6.x-1.1:
I commented out the if statement as mentioned above, but just curious if a proper solution has been found for this.
Thanks
Mike
Comment #9
VanessaM CreditAttribution: VanessaM commentedI am getting the same error too
Comment #10
Scott Robertson CreditAttribution: Scott Robertson commentedIt seems that the original intention for the code was to set an updated message, but only when on the wishlist page itself.
The entire check and drupal_set_message() call seem redundant, as there is already a different drupal_set_message() call in uc_wishlist_settings_form_submit() which is always called upon submitting the wish list form.
My suggestion would just be to remove this piece of code entirely. Patch attached.
Comment #12
Sagar Ramgade CreditAttribution: Sagar Ramgade commentedFixed in latest 6.x-1.x-dev release.
Comment #14
VM CreditAttribution: VM commentedComment #15
allisonc CreditAttribution: allisonc commentedI changed
to
for this error.