Fatal error: Cannot use object of type stdClass as array in E:\Dev sites\fangbianwang\sites\all\modules\domain\domain.module on line 1080
here is the code in domain.module

// Did we get a valid result?
->1080 if (isset($domain['domain_id'])) {
->1081 // Let Domain Access module extensions act to override the defaults.
->1082 $domains[$key] = domain_api($domain, $reset);
->1083 }
->1084 else {
->1085 $domains[$key] = -1;
->1086 }

cause error when enable the domain access module use oracle driver , use mysql database is ok.
windows 8
apache 2.2.22
php 5.3.13
oracle 11g express

OCI8 Support: enabled
Version : 1.4.7
Revision: $Id: bf2eaf558b050b6d2e6d098bed6345af7e842ea4 $
Active Persistent Connections : 0
Active Connections: 0
Oracle Run-time Client Library Version: 11.2.0.3.0
Oracle Instant Client Version : 10.2
Temporary Lob support : enabled
Collections support : enabled

Comments

shoufeng.xi’s picture

Assigned: Unassigned » shoufeng.xi
StatusFileSize
new88.42 KB

domain.module in oracleupdate: use oracle $domain is stdClass object
but use mysql $domain is null

agentrickard’s picture

The problem is likely caused by mishandling of this query (line 1057).

      $result = db_query("SELECT domain_id, subdomain, sitename, scheme, valid, weight, is_default, machine_name FROM {domain}", array(), array('fetch' => PDO::FETCH_ASSOC))->fetchAllAssoc('domain_id');

So here we are trying to return an array or arrays, which is not the standard PDO behavior, but is supported by the API.

shoufeng.xi’s picture

so what should to do? I'm not familiar with code. and why there is no error use mysql.

update: and you said It's oracle driver bug in another duplicate issue I post.

update:
$result = db_query("SELECT domain_id, subdomain, sitename, scheme, valid, weight, is_default, machine_name FROM {domain}", array(), array('fetch' => PDO::FETCH_ASSOC))->fetchAllAssoc('domain_id');
$result return different use oracle or mysql

mysql

array(1) (
  [1] => array(8) (
    [domain_id] => (string) 1
    [subdomain] => (string) fbw.com
    [sitename] => (string) fbw
    [scheme] => (string) http
    [valid] => (string) 1
    [weight] => (string) -1
    [is_default] => (string) 1
    [machine_name] => (string) fbw_com
  )
)

but oracle

array(1) (
  [0] => stdClass object {
    domain_id => (string) 0
    subdomain => (string) fbw.com
    sitename => (string) fbw.com
    scheme => (string) http
    valid => (string) 1
    weight => (string) -1
    is_default => (string) 1
    machine_name => (string) fbw_com
  }
)
shoufeng.xi’s picture

change
$result = db_query("SELECT domain_id, subdomain, sitename, scheme, valid, weight, is_default, machine_name FROM {domain}", array(), array('fetch' => PDO::FETCH_ASSOC))->fetchAllAssoc('domain_id');
to
$result = db_query("SELECT domain_id, subdomain, sitename, scheme, valid, weight, is_default, machine_name FROM {domain}", array(), array('fetch' => PDO::FETCH_ASSOC))->fetchAllAssoc('domain_id',PDO::FETCH_ASSOC);

It's work!

=================================
update: not work!


use oracle return:

array(1) (
  [0] => array(8) (
    [domain_id] => (string) 0
    [subdomain] => (string) fbw.com
    [sitename] => (string) fbw.com
    [scheme] => (string) http
    [valid] => (string) 1
    [weight] => (string) -1
    [is_default] => (string) 1
    [machine_name] => (string) fbw_com
  )
)

mysql return:

array(1) (
  [1] => array(8) (
    [domain_id] => (string) 1
    [subdomain] => (string) fbw.com
    [sitename] => (string) fbw
    [scheme] => (string) http
    [valid] => (string) 1
    [weight] => (string) -1
    [is_default] => (string) 1
    [machine_name] => (string) fbw_com
  )
)

help!!!!!!!!!!!!!!!!!!!!!

shoufeng.xi’s picture

I look up the database
the domain table have one record. in mysql domain_id value is 1, in oracle domain_id value is 0.
I manually change it to 1; It work ! strange !!

need help!!

update:0 is the default value in the schema

agentrickard’s picture

There is no error in MySQL or PostGreSQL of MSSQl because they handle the PDO construction as expected. This needs to be fixed by the Oracle driver code.

Either that or the Oracle version is doing odd things to the id.

But since Drupal core doesn't support Oracle, this is the best place to get help.

bohart’s picture

Version: 7.x-1.12 » 7.x-1.x-dev
Assigned: shoufeng.xi » Unassigned
Issue summary: View changes
Status: Active » Closed (outdated)

D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.

Everyone can apply the patches/suggestions above (not tested by the maintainers, tested by the community) to their D7 projects.
If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.

Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.