Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:08:19+00:00 2026-06-13T13:08:19+00:00

When implementing an object using ArrayAccess or ArrayObject , to some operations it’s a

  • 0

When implementing an object using ArrayAccess or ArrayObject, to some operations it’s a perfectly normal array (for instance a foreach() statement). Others, however, are not so easily fooled and still complain it is an object:

[E_WARNING] call_user_func_array() expects parameter 2 to be array, object given

This strikes me as incosistent. Can someone explain the reasoning behind this? Is there a way around this?

I need this to support backend code. It requires an array (passed as a parameter to call_user_func_array()), and sometimes modifies it. I need to mirror any changes made to the array to the new variables however, so that’s why I tried to do it via an ArrayAccess object (more info here).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:08:21+00:00Added an answer on June 13, 2026 at 1:08 pm

    Thye function name is pretty explicit, and the description in the documents indicates why it requires an array

    The solution is to wrap your object inside an array

    call_user_func_array('callback', array( $myObject));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help with correctly implementing the USING statement with strongly typed TableAdapters
Implementing ArrayAccess Interface in PHP , We can access Object Properties as Array Keys
Using the Qt DBus library, I'm having a hard time registering an object implementing
I'm implementing some code using the java.util.concurrency framework. I will be passing a collection
I stated implementing object oriented design into my website. I'm using php, and ran
Well... I'm actually implementing a class to convert any object to another using a
Possible Duplicate: Count elements for objects implementing ArrayAccess using count()? In PHP 5, you
I'm planning on implementing some tests using nUnit. I also have a homegrown metrics
I'm implementing object caching in a PHP application using APC. The issue is, that
I am implementing a relatively complex object model service using WWSAPI (WCF hosted) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.