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'.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

funjay’s picture

Status: Needs review » Active
holljac’s picture

Issue tags: +Problem with substr in uc_wishlist.module

I have the same issue. Is there a fix?

shout’s picture

I 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.

jerry’s picture

Subscribing.

MustangGB’s picture

Getting this also
I'm not sure when this message is intended for display
So no idea how to fix it

sibiru’s picture

I 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
.............
................

MustangGB’s picture

Yes 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

BigMike’s picture

I 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:

414:  // Rebuild the items hash
415:  uc_wishlist_get_contents();
416:  if (!substr(request_uri(), 'wishlist', -4)) {
417:    drupal_set_message(t('Your item(s) have been updated.'));
418:  }

I commented out the if statement as mentioned above, but just curious if a proper solution has been found for this.

Thanks
Mike

VanessaM’s picture

I am getting the same error too

Scott Robertson’s picture

Status: Active » Needs review
FileSize
868 bytes

It 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.

  • Sagar Ramgade committed 1136637 on 6.x-1.x
    Issue #902028 by funjay: Problem with substr in uc_wishlist.module
    
Sagar Ramgade’s picture

Issue summary: View changes
Status: Needs review » Fixed

Fixed in latest 6.x-1.x-dev release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

VM’s picture

Issue tags: -Problem with substr in uc_wishlist.module
allisonc’s picture

I changed

substr

to

strpos 

for this error.