Just installed CCK from cvs version, and enabled several types as well as content.module.
Now when I go to add a new content type, I get back a completely empty page - not even the header and sidebars show up.
Also, no existing content types are listed at Administer->Content->Content Types->list - shouldn't there be some built-in types listed here?

I have no idea where to begin looking for the solution to this - all clues appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gateone’s picture

Same here. Error log says:

[Mon May 22 19:49:59 2006] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error: Cannot use object of type stdClass as array in /my/path/to/my/webroot/drupal/modules/cck/content_admin.inc on line 78, referer: http://myserver.com/drupal/admin/node/types/types

Code Rader’s picture

Similar errors here. From // $Id: content_admin.inc,v 1.15 2006/05/21 21:37:31 JonBob Exp

warning: Cannot use a scalar value as an array in /var/www/vhosts/sanangelolive.com/httpdocs/modules/contributed/cck/content_admin.inc on line 78.
warning: Cannot use a scalar value as an array in /var/www/vhosts/sanangelolive.com/httpdocs/modules/contributed/cck/content_admin.inc on line 79.
warning: Cannot use a scalar value as an array in /var/www/vhosts/sanangelolive.com/httpdocs/modules/contributed/cck/content_admin.inc on line 80.
warning: Cannot use a scalar value as an array in /var/www/vhosts/sanangelolive.com/httpdocs/modules/contributed/cck/content_admin.inc on line 81.

Happens when I go to admin/node/types/add

mediafrenzy’s picture

I'm getting the same errors on a fresh install of latest drupal 4.7 and cvs CCK.

mediafrenzy’s picture

(To clarify - the errors I am seeing are the Scalar Array errors above)

lekei’s picture

Anybody have the previous build? I picked the WRONG day to update!

mediafrenzy’s picture

I don't know much about CVS, but is it possible to get the previous version of CCK through the CVS interface perhaps?

pbarnett’s picture

Version: 6.x-1.x-dev » 4.7.x-1.x-dev

The error is caused by content_admin.inc having

      $type = new stdClass();
      $type['label'] = '';
      $type['description'] = '';
      $type['help'] = '';
      $type['title_label'] = 'Title';

when it should be

      $type = new stdClass();
      $type->label = '';
      $type->description = '';
      $type->help = '';
      $type->title_label = 'Title';

because stdClass isn't an array.

mfredrickson’s picture

FileSize
601 bytes

I can reproduce.

According to http://drupal.org/cvs?commit=32385 types should be arrays, not objects. Attached patch fixes the error.

RayZ’s picture

Status: Active » Needs review
pbarnett’s picture

Sorry about that; looks like I was fixing the syntax, not the problem. $type=array() certainly fixes it. Thanks, chaps!

EduardoMercovich’s picture

OK, I have the same problem and the issue is being worked on. I'd like to help and know nothing about programming, but I can test any modifications.

How do I get notified about a new version? Just by visiting this thread or I can subcribe to a feed?

Thanks...

mediafrenzy’s picture

I'm wondering whether changing to an array has caused issues when trying to use the node_import module with CCK?

As described here:
http://drupal.org/node/65278

RayZ’s picture

Category: support » bug
Julien PHAM’s picture

Priority: Normal » Critical

I have the same problem too. Any good fix someone? :p
I'm using CVS version.

The problem about the scalar values.

RayZ’s picture

Doesn't the patch in #8 fix it for you?

Julien PHAM’s picture

Oh yes sorry :p It works, thanks...

EduardoMercovich’s picture

After searching and reading in Drupal and other places about patching, I tried to apply the patch in #8 (cck.adminerror.patch) with no luck.

Could someone help me by:
a- give the command (in Linux, almost everything about patching in Drupal is for Win), or
b - giving me the patched cck/content_admin.inc?

I know that for devs patching is like breathing, but unfortunately, I am not developer. :-)

Thanks a lot for your help.

Regards...

RayZ’s picture

Status: Needs review » Reviewed & tested by the community

Identical patch submitted by drumm to duplicate issue http://drupal.org/node/65997 . Setting to RTBC.

Torenware’s picture

I just found a similar problem around line 52 of content_admin.inc (where a call to db_fetch_object needs to get changed to db_fetch_array).

Who do we need to get looking at this one?

v. 1.15 of this file in Drupal CVS needs some QA.

KarenS’s picture

FileSize
975 bytes

Here's a patch that fixes both places, the one fixed in the first patch and the other object reference on line 52.

KarenS’s picture

FileSize
38.7 KB

For those who need it, here is the patched content_admin.inc

KarenS’s picture

Title: Administer->Content->Content Types->add content type returns empty page » Error - Cannot use a scalar value as an array

Changing title to maybe help reduce number of duplicate posts of this problem.

lekei’s picture

The way to stop duplicate posts is to fix the bug and re-release the module. People can't believe that a fatal typo-type bug like this isn't fixed immediately, so they report it. And report it. And report it.

If a bug is known and has been fixed but the newest version contains a bug it must be a new bug. A lot of people mistakenly believe that non-programmens can use Drupal.

Don't complain when the fix has been known for almost 2 weeks and the module is still broken. Patches do not count as a fix. They should be considered a testing measure.

Avoid the temptation to patch. Patching modules leads to hacking modules which is the path to the Dark Side.

Remember that many people cannot use patch (or believe that they can't) because they do not have shell access on their host and they are running Windows (I still haven't found a version of patch that works properly on Windows; I finally resorted to the command-line version).

RayZ’s picture

The way to stop duplicate posts is to fix the bug and re-release the module. People can't believe that a fatal typo-type bug like this isn't fixed immediately, so they report it. And report it. And report it.

True, but JonBob needs a vacation too (I assume that's why he hasn't been seen for a few weeks?). Anybody else around that can commit a small typo-fix patch like this one?

EduardoMercovich’s picture

Thanks KarenS for your #21 file. :-)

Best regards...

KarenS’s picture

The Drupal commit process was changed recently and only the project maintainers can commit unless they explicitly give permission to someone else to do it, so most likely only JonBob can get a change committed.

lekei, I posted both the patch and the patched file so everyone (programmer or not) can keep using the module until JonBob can get the cvs version updated.

moshe weitzman’s picture

I emailed JonBob about this and about assigning more committers

JonBob’s picture

Status: Reviewed & tested by the community » Fixed

I deeply apologize for the delay. The HEAD patch has been committed.

I cannot reproduce the issue in 4.7 right away, though. Is it happening there still?

Anonymous’s picture

Status: Fixed » Closed (fixed)
dmitrig01’s picture

Version: 4.7.x-1.x-dev » 6.x-1.x-dev
Status: Closed (fixed) » Active

Found the same thing on line 77. Seting this to active

killes@www.drop.org’s picture

Status: Active » Fixed

can't repro on 4.7.

Anonymous’s picture

Status: Fixed » Closed (fixed)
abhinya’s picture

Declare the array. The error gets removed once you declare the array. In the following example we declare field as an array before declaring the array.

    $field = array();
    $field[0]="monkey";
    $field[1]="donkey";
    $field[2]="hockey";
    $hockey = 173;
    print "My " . $field[0] . " is " . ${$field[2]} . " years old";