Once again dont know if I'm doing this correctly....

* Warning: array_splice() expects parameter 3 to be long, string given in _chain_menu_access_callback() (line 59 of /var/www/drupal/sites/all/modules/chain_menu_access/chain_menu_access.module).

I'm running ACL 7.x-1.0-beta2
and Forum Access 7.x-1.0-alpha4

Comments

bazzly’s picture

salvis’s picture

Title: Warning » Warning: array_splice() expects parameter 3 to be long, string given in _chain_menu_access_callback() (line 59

Thanks for opening a new issue. If you find a problem for which there's no existing issue, then opening a new issue is the way to go, then it can be managed as needed.

What's the path/URL of the page where you get that warning?

Please answer the question in #995214-3: Chain Menu Access API for D6 and D7 — D7 RELEASED, too.

salvis’s picture

I'm sorry, it seems I'm confusing you. This is not my intention.

The idea here on drupal.org is that every thread has one subject, and if that subject is complete, then the thread will be closed.

If you see something that's not working right, and you don't find a thread that already discusses it, then open a new issue, where everything about this problem will be discussed. In the end, this will hopefully result in a solution, and the state will be set to fixed.

This is what we're doing here for #1036478: Warning: array_splice() expects parameter 3 to be long, string given in _chain_menu_access_callback() (line 59. Ideally, we discuss this and nothing else, and we discuss this here and nowhere else.

The issue titled #995214: Chain Menu Access API for D6 and D7 — D7 RELEASED is not about specific warnings that we hope to fix within a week or two, but it's supposed to live as long as Chain Menu Access API is in BETA or RC status. I will close it when the module is released, after it has collected lots of positive feedback and the module seems to work for everyone.

I would have liked you to answer the question

What's the path/URL of the page where you get that warning?

here and answer the other question in the other thread about how I could improve my queue management in the other thread.

I got one of the answers: the path is 'forum'. That'll let work on the warning.

salvis’s picture

Oh, and BTW, if you post your issue in the wrong issue queue, then that's only a minor problem, because issues can easily be moved from one module to another, IF they are an issue by themselves. Obviously, if you add a chain_menu_access problem under the heading #809404: Forum Access for D7, then I can't move #809404: Forum Access for D7 to the Chain Menu Access API queue.

I hope this clears things up a bit for you.

bazzly’s picture

Yes that helps a bit. I'm sorry I'm a total noob at bug reporting.
So yes when I go from my home screen directly to the forum I get the warrning. Below is the URL. Could it be because its not a name, but an IP? I suppose I could try to use a host name and see if that fixes it. Should I give that ago? Is it even related?
http://10.8.193.159/forum

salvis’s picture

There's no need to apologize. We've all been new at this at some point. You would really help me if you could tell me how to make this clearer for newcomers, because you're certainly not the only one who messes up my long-running development issues.

 

No, the IP address doesn't make any difference.

Can you try changing line 59 in chain_menu_access.module from

  $new_access_arguments = array_splice($args, 0, $count, array());

to

  $new_access_arguments = array_splice($args, 0, (int) $count, array());

? IOW, insert (int) ?

This may make the warning go away, or it may turn it into an actual error. Which one is it?

bazzly’s picture

I'll be back at the machine that has it tomorrow, so I'll give it ago then and report back.

To be honest...I'm not sure. The first BIG problem for me after you made the statement was I had one heck of a time finding the "Create a new issue" , or even locating the issues link. To be honest I thought the bug report was kinda like posting in a forum. I see it a little bit different.

So just to give you a little insight...I did a google search for the error and it gave me the link I first posted in. I think it would have helped "me" if there was a link under or next to the title of the issue that has "check current issues".

So if it were me...I think I would post something along these lines....

If you landed here by a search, please check the current issues (giving the link) and see if your problem has been posted. If it has, please go to that issue so you can discuss and check the stats of development. If your issue is not been posted please create a new issue by clicking "Create a new issue" (link). If you are unsure if you should create a new issue please feel free to (however you want to handle it)

The only reason I put the "if you are unsure", is because in the past I have held back because I didnt want to look like a total goof. Sadly when people do that; Such as I..... You never know...That person could have the missing link to a problem.

Hope that helps....

salvis’s picture

Yes, that helps, thank you for sharing your experience! I'll definitely add links.

I think I'm already at the upper limit on the number of ifs and your text has even more, but I get your idea and will think about it when the next version is ready.

bazzly’s picture

I agree....I did write that quite poorly...As long as the idea is there I suppose...

bazzly’s picture

Changing that line seems to have fixed it....No more warning.
Thanks!

salvis’s picture

Thank you, that's a cheap fix.

It's weird. $count is an int, but apparently that fact gets lost somewhere along the line, and array_splice() is unusually peculiar about the type. We can easily cast it back to int if that keeps PHP happy...

What is your PHP version?

bazzly’s picture

well doing php -v I get PHP 5.3.3-1ubuntu9.3 with Suhosin-Patch

I do have a question....You said just to add this " $new_access_arguments = array_splice($args, 0, (int) $count, array());" correct?
What was the "? IOW, insert (int) ?" posed below?
Just wondering

salvis’s picture

No, change the line that looked like

  $new_access_arguments = array_splice($args, 0, $count, array());

so that it now looks like

  $new_access_arguments = array_splice($args, 0, (int) $count, array());

In Other Words, insert just six characters, namely

" (int)"

bazzly’s picture

Ahh Okay....good, because that is what I did!
"$new_access_arguments = array_splice($args, 0, (int) $count, array());"
Thanks

Anonymous’s picture

I was experiencing this problem as well and by casting count to int as suggested on #6 fixed it.
Thanks

kidsil’s picture

worked for me, thanks

salvis’s picture

Status: Active » Fixed

Fixed in the 7.x-1.x-dev version on Jan 28 and in 6.x-1.x-dev just now.

Status: Fixed » Closed (fixed)

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