[SOLVED] Error: Warning: Wrong datatype for [...] in_array

rvermaat

Joined: 2005-01-22
Posts: 6
Posted: Sun, 2005-05-15 09:52

Hi,

Since a couple of days when I add/delete items (foto's and albums) I get for example the following error message in my browser:

Warning: Wrong datatype for first argument in call to in_array in /home/robv/public_html/gallery2/modules/core/classes/Gallery.class on line 834

Warning: Cannot add header information - headers already sent by (output started at /home/robv/public_html/gallery2/modules/core/classes/Gallery.class:834) in /home/robv/public_html/gallery2/main.php on line 453

The foto's/albums have been added/delete from the gallery !!!!!!

Robin

<TYPE YOUR MESSAGE HERE, ENTER SYSTEM DETAILS BELOW>
<Please check the G2 FAQ (sticky topic in this forum) before posting!>
----

Gallery URL (optional):
Gallery version: latest csv version
Webserver (with version): Apache/1.3.27 (Unix) (Red-Hat/Linux)
Datatabase (with version): mysql Ver 11.17 Distrib 3.23.49a, for pc-linux-gnu (i686)
PHP version (eg 4.2.1): 4.1.2
phpinfo URL (optional):
Graphics Toolkit(s): ImageMagick / NetPMB
Operating system: Linux version 2.4.9-31custom (root@telematics.xs4all.nl) (gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)) #1 Wed Jun 12 13:27:55 GMT-1 2002
Web browser/version: FireFox 1.04 and IE v6 SP2
G1 version (for migration bugs): None

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-05-15 11:58

Let's first check if your albums/photos really have been deleted.
go to you g2data directory, and check g2data/albums/. Are your albums and photos still there?
Background:
Theoretically, in most setups on shared webhostings, other customers of the same shared webhosting have enough permissions to delete all your data in g2data (via scripts that run under the webserver user).

And if the problem in Gallery.class persists, we'll have to debug a little.

 
rvermaat

Joined: 2005-01-22
Posts: 6
Posted: Sun, 2005-05-15 12:27

Hi,

When I add photo's (using the web interface) the fotos are copied to the g2data/albums directorie. When I delete them again they are removed from the g2data/albums.

I have full (root) access to the server I'm running the gallery from. But because more users are using this server i'm running the gallery under my own user account.

What do I have to do to debug this futher and track down the problem...

Robin

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-05-15 14:55

Ah, sorry. I guess I didn't understand you correctly, my bad.

Quote:
The foto's/albums have been added/delete from the gallery !!!!!!

That's why I thought your albums/photos have been deleted.
But I guess the message was "i get an error during add/delete operations, but the add/delete operations still work."

So, let's concentrate on that Gallery.class function addShutdownAction() error.

Are you ready to debug it?
We'd have to activate the buffered debug mode in config.php.
And we'd have to change
The function addShutDownAction() of Gallery.class would need to be changed a little to output some debug information.
replace:

    function addShutdownAction($callback, $parameters) {
	if (!isset($this->_shutdownActions)) {
	    $this->_shutdownActions = array();
	}
	$action = array($callback, $parameters);
	/* Skip duplicate actions */
	if (!in_array($action, $this->_shutdownActions)) {
	    $this->_shutdownActions[] = $action;
	}
    }

with:

     function addShutdownAction($callback, $parameters) {
	global $gallery;
	if (!isset($this->_shutdownActions)) {
	    $this->_shutdownActions = array();
	}
	$action = array($callback, $parameters);
	/* Skip duplicate actions */
	ob_start();
	print 'addShutdownAction: action "';
	var_dump($action);
	print '", shutdownActions: "';
	var_dump($this->_shutdownActions);
	print '"';
	$debugInfo = ob_get_clean();
	$gallery->debug($debugInfo);
	if (!in_array($action, $this->_shutdownActions)) {
	    $this->_shutdownActions[] = $action;
	}
    } 

then try to cause the error (add/delete an item) and search the debug output for "addShutdownAction" and print the results here in the forum.

It's up to you...

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2005-05-15 15:06

Ah, checked the php docs and I used something not allowed in PHP 4.1.x.
I'll look into a fix.

Edit: valiant, I see your post now.. the problem is in_array($x,$y).. $x cannot be an array in PHP 4.1.x.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-05-15 15:26

mmkay :)
first checked the php manual too, but forgot about checking if the first element can be an array.
Hmm, wonder if have used that incorrectly too.

 
rvermaat

Joined: 2005-01-22
Posts: 6
Posted: Sun, 2005-05-15 15:55

Hi,

When I create and album name "tes1t":

addShutdownAction: action "array(2) { [0]=>  array(2) { [0]=>  string(14) "GalleryCoreApi" [1]=>  string(27) "updateModificationTimestamp" } [1]=>  array(1) { [0]=>  int(7) } } ", shutdownActions: "array(0) { } "
Fatal error: Call to undefined function: ob_get_clean() in /home/robv/public_html/gallery2/modules/core/classes/Gallery.class on line 844

Then i delete the album "test1":

addShutdownAction: action "array(2) { [0]=>  array(2) { [0]=>  string(14) "GalleryCoreApi" [1]=>  string(27) "updateModificationTimestamp" } [1]=>  array(1) { [0]=>  int(7) } } ", shutdownActions: "array(0) { } "
Fatal error: Call to undefined function: ob_get_clean() in /home/robv/public_html/gallery2/modules/core/classes/Gallery.class on line 844

After this I try to create album test1 again (test1 was delete from my) I now get a different error (its a lot)

Quote:
An error has occurred.

Back to the Gallery
Error Detail -
Error (ERROR_MISSING_OBJECT)

* in modules/core/ItemAddAlbum.inc at line 85
* in main.php at line 177
* in main.php at line 96

System Information
Gallery version 2.0-beta-2+
PHP version 4.1.2 apache
Webserver Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6 DAV/1.0.2 PHP/4.1.2 mod_perl/1.24_01 mod_throttle/3.1.2
Database mysql 3.23.49a
Toolkits ImageMagick, SquareThumb, NetPBM
Operating system Linux daffy.perf.redhat.com 2.4.18-11smp #1 SMP Thu Aug 15 06:41:59 EDT 2002 i686 unknown
Browser Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050416 Fedora/1.0.3-1.3.1 Firefox/1.0.3
Gallery Debug Output

file_exists(/home/robv/public_html/gallery2/g2data/cache/module/_all/0/0/GalleryFactoryHelper_loadRegistry.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/module/_all/0/0/GalleryFactoryHelper_loadRegistry.inc,
rb, 0)
fread(Resource id #1, 4096)
fread(Resource id #1, 4096)
fread(Resource id #1, 4096)
fclose(Resource id #1)
file_exists(/home/robv/public_html/gallery2/modules/core/classes/helpers/../../../../modules/rewrite/classes/RewriteUrlGenerator.class)

(mysql):
SELECT
g2_RewriteMap.g_match, g2_RewriteMap.g_pattern
FROM
g2_RewriteMap
WHERE
g2_RewriteMap.g_match != ''

file_exists(/home/robv/public_html/gallery2/g2data/sessions/92be1fcdc398c3feeff853893f683e5e)
fopen(/home/robv/public_html/gallery2/g2data/sessions/92be1fcdc398c3feeff853893f683e5e,
rb, 0)
feof(Resource id #4)
fread(Resource id #4, 4096)
feof(Resource id #4)
fread(Resource id #4, 4096)
feof(Resource id #4)
fread(Resource id #4, 4096)
feof(Resource id #4)
fread(Resource id #4, 4096)
feof(Resource id #4)
fclose(Resource id #4)
Continuing navigation x9652b7af
file_exists(/home/robv/public_html/gallery2/modules/core/classes/helpers/../../../../modules/core/module.inc)
realpath(/home/robv/public_html/gallery2/modules/core/classes/../../..)
Binding text domain: modules_core ->
/home/robv/public_html/gallery2/modules/core/locale
file_exists(/home/robv/public_html/gallery2/g2data//versions.dat)
file(/home/robv/public_html/gallery2/g2data//versions.dat, )
[1116175839] can't guarantee 5 -- extending!
file_exists(/home/robv/public_html/gallery2/g2data/cache/entity/0/1/14.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/entity/0/1/14.inc, rb,
0)
fread(Resource id #5, 4096)
fclose(Resource id #5)
file_exists(/home/robv/public_html/gallery2/g2data/cache/module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc,
rb, 0)
fread(Resource id #6, 4096)
fread(Resource id #6, 4096)
fread(Resource id #6, 4096)
fclose(Resource id #6)
file_exists(/home/robv/public_html/gallery2/modules/core/classes/../../../modules/core/ItemAddAlbum.inc)
file_exists(/home/robv/public_html/gallery2/modules/core/classes/../../../modules/core/ItemAddAlbum.inc)
file_exists(/home/robv/public_html/gallery2/g2data/cache/module/core/0/0/0.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/module/core/0/0/0.inc,
rb, 0)
fread(Resource id #7, 4096)
fclose(Resource id #7)
fopen(/home/robv/public_html/gallery2/g2data/locks/0/7/7, wb+, 0)
flock(Resource id #8, 5, )
file_exists(/home/robv/public_html/gallery2/g2data/cache/entity/0/0/7.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/entity/0/0/7.inc, rb, 0)
fread(Resource id #9, 4096)
fclose(Resource id #9)
fopen(/home/robv/public_html/gallery2/g2data/locks/0/7/7, wb+, 0)
flock(Resource id #10, 5, )

(mysql):
SELECT
g2_MimeTypeMap.g_mimeType
FROM
g2_MimeTypeMap
WHERE
g2_MimeTypeMap.g_extension = ''

(mysql):
SELECT
COUNT(g2_ChildEntity.g_id)
FROM
g2_ChildEntity, g2_FileSystemEntity
WHERE
g2_ChildEntity.g_parentId = '7'
AND
g2_FileSystemEntity.g_pathComponent = 'test1'
AND
g2_ChildEntity.g_id = g2_FileSystemEntity.g_id

(mysql): update g2_SequenceId set id=LAST_INSERT_ID(id+1);

(mysql):
SELECT
g2_DerivativePrefsMap.g_order,
g2_DerivativePrefsMap.g_derivativeType,
g2_DerivativePrefsMap.g_derivativeOperations
FROM
g2_DerivativePrefsMap
WHERE
g2_DerivativePrefsMap.g_itemId = '7'
ORDER BY
g2_DerivativePrefsMap.g_order ASC

(mysql): INSERT INTO g2_DerivativePrefsMap (g_itemId, g_order,
g_derivativeType, g_derivativeOperations) VALUES (8568, 0, 2, 'scale|640,
640')

(mysql): INSERT INTO g2_DerivativePrefsMap (g_itemId, g_order,
g_derivativeType, g_derivativeOperations) VALUES (8568, 0, 1,
'thumbnail|150')

file_exists(/home/robv/public_html/gallery2/g2data/albums/test1)
fclose(Resource id #10)
file_exists(/home/robv/public_html/gallery2/g2data/locks/0/7/7)

(mysql):
SELECT
g2_UserGroupMap.g_userId
FROM
g2_UserGroupMap
WHERE
g2_UserGroupMap.g_userId = 14
AND
g2_UserGroupMap.g_groupId = '3'
LIMIT 1

realpath(/home/robv/public_html/gallery2/modules/core/classes/../../../)

This page is valid XHTML 1.0 Gallery 2.0-beta-2+ Gallery 2 - Beta 3: Bingo!
Gallery Debug Output

file_exists(/home/robv/public_html/gallery2/g2data/cache/module/_all/0/0/GalleryFactoryHelper_loadRegistry.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/module/_all/0/0/GalleryFactoryHelper_loadRegistry.inc,
rb, 0)
fread(Resource id #1, 4096)
fread(Resource id #1, 4096)
fread(Resource id #1, 4096)
fclose(Resource id #1)
file_exists(/home/robv/public_html/gallery2/modules/core/classes/helpers/../../../../modules/rewrite/classes/RewriteUrlGenerator.class)

(mysql):
SELECT
g2_RewriteMap.g_match, g2_RewriteMap.g_pattern
FROM
g2_RewriteMap
WHERE
g2_RewriteMap.g_match != ''

file_exists(/home/robv/public_html/gallery2/g2data/sessions/92be1fcdc398c3feeff853893f683e5e)
fopen(/home/robv/public_html/gallery2/g2data/sessions/92be1fcdc398c3feeff853893f683e5e,
rb, 0)
feof(Resource id #4)
fread(Resource id #4, 4096)
feof(Resource id #4)
fread(Resource id #4, 4096)
feof(Resource id #4)
fread(Resource id #4, 4096)
feof(Resource id #4)
fread(Resource id #4, 4096)
feof(Resource id #4)
fclose(Resource id #4)
Continuing navigation x9652b7af
file_exists(/home/robv/public_html/gallery2/modules/core/classes/helpers/../../../../modules/core/module.inc)
realpath(/home/robv/public_html/gallery2/modules/core/classes/../../..)
Binding text domain: modules_core ->
/home/robv/public_html/gallery2/modules/core/locale
file_exists(/home/robv/public_html/gallery2/g2data//versions.dat)
file(/home/robv/public_html/gallery2/g2data//versions.dat, )
[1116175839] can't guarantee 5 -- extending!
file_exists(/home/robv/public_html/gallery2/g2data/cache/entity/0/1/14.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/entity/0/1/14.inc, rb,
0)
fread(Resource id #5, 4096)
fclose(Resource id #5)
file_exists(/home/robv/public_html/gallery2/g2data/cache/module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc,
rb, 0)
fread(Resource id #6, 4096)
fread(Resource id #6, 4096)
fread(Resource id #6, 4096)
fclose(Resource id #6)
file_exists(/home/robv/public_html/gallery2/modules/core/classes/../../../modules/core/ItemAddAlbum.inc)
file_exists(/home/robv/public_html/gallery2/modules/core/classes/../../../modules/core/ItemAddAlbum.inc)
file_exists(/home/robv/public_html/gallery2/g2data/cache/module/core/0/0/0.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/module/core/0/0/0.inc,
rb, 0)
fread(Resource id #7, 4096)
fclose(Resource id #7)
fopen(/home/robv/public_html/gallery2/g2data/locks/0/7/7, wb+, 0)
flock(Resource id #8, 5, )
file_exists(/home/robv/public_html/gallery2/g2data/cache/entity/0/0/7.inc)
fopen(/home/robv/public_html/gallery2/g2data/cache/entity/0/0/7.inc, rb, 0)
fread(Resource id #9, 4096)
fclose(Resource id #9)
fopen(/home/robv/public_html/gallery2/g2data/locks/0/7/7, wb+, 0)
flock(Resource id #10, 5, )

(mysql):
SELECT
g2_MimeTypeMap.g_mimeType
FROM
g2_MimeTypeMap
WHERE
g2_MimeTypeMap.g_extension = ''

(mysql):
SELECT
COUNT(g2_ChildEntity.g_id)
FROM
g2_ChildEntity, g2_FileSystemEntity
WHERE
g2_ChildEntity.g_parentId = '7'
AND
g2_FileSystemEntity.g_pathComponent = 'test1'
AND
g2_ChildEntity.g_id = g2_FileSystemEntity.g_id

(mysql): update g2_SequenceId set id=LAST_INSERT_ID(id+1);

(mysql):
SELECT
g2_DerivativePrefsMap.g_order,
g2_DerivativePrefsMap.g_derivativeType,
g2_DerivativePrefsMap.g_derivativeOperations
FROM
g2_DerivativePrefsMap
WHERE
g2_DerivativePrefsMap.g_itemId = '7'
ORDER BY
g2_DerivativePrefsMap.g_order ASC

(mysql): INSERT INTO g2_DerivativePrefsMap (g_itemId, g_order,
g_derivativeType, g_derivativeOperations) VALUES (8568, 0, 2, 'scale|640,
640')

(mysql): INSERT INTO g2_DerivativePrefsMap (g_itemId, g_order,
g_derivativeType, g_derivativeOperations) VALUES (8568, 0, 1,
'thumbnail|150')

file_exists(/home/robv/public_html/gallery2/g2data/albums/test1)
fclose(Resource id #10)
file_exists(/home/robv/public_html/gallery2/g2data/locks/0/7/7)

(mysql):
SELECT
g2_UserGroupMap.g_userId
FROM
g2_UserGroupMap
WHERE
g2_UserGroupMap.g_userId = 14
AND
g2_UserGroupMap.g_groupId = '3'
LIMIT 1

realpath(/home/robv/public_html/gallery2/modules/core/classes/../../../)

I also have a "smart debug console output"

Quote:
Smarty Debug Console
included templates & config files (load time in seconds):
gallery:templates/global.tpl (0.14997) (total)
gallery:templates/errorHead.tpl (0.00318)
gallery:templates/errorBody.tpl (0.01935)
gallery:templates/debug.tpl (0.00866)
gallery:templates/debug.tpl (0.11399)
assigned template variables:
{$SCRIPT_NAME} /~robv/gallery2/main.php
{$head} Array (2)
tpl => Array (1)
templates/errorHead.tpl => modules_core
style => Array (2)
0 => templates/layout.css
1 => themes/matrix/theme.css
{$l10Domain} modules_core
{$main} Array (9)
isAdmin => 1
error => Array (9)
stackTrace => Error (ERROR_MISSING_OBJECT)<UL><LI>...
phpversion => 4.1.2
php_uname => Linux daffy.perf.redhat.com 2.4.18-11...
php_sapi_name => apache
webserver => Apache/1.3.27 (Unix) (Red-Hat/Linux)...
browser => Mozilla/5.0 (X11; U; Linux i686; en-U...
dbType => mysql
dbVersion => 3.23.49a
toolkits => ImageMagick, SquareThumb, NetPBM
viewBodyFile => templates/errorBody.tpl
viewL10Domain => modules_core
debug => file_exists(/home/robv/public_html/ga...
markupType => bbcode
isRightToLeft =>
validationUri => javascript:alert('Validation disabled...
gallery => Array (1)
version => 2.0-beta-2+
assigned config file variables (outer template scope):
{#files#} Array (0)
{#vars#} Array (0)FAQ Gallery:a.1

Hope this helps...

Robin

 
rvermaat

Joined: 2005-01-22
Posts: 6
Posted: Sun, 2005-05-15 16:04

Some additions.

I could not create the test1 album for a second time because the album was not delete from the g2data/albums directory. When i manualy removed it I could recreate the album again !

Robin

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-05-15 16:33

rvermaat, thank you.
mindless already found the problem. We're using a php functionality that was introduced in a later php than you have installed. But this not your problem, because we want G2 to work on older php setups.

Please stay tuned, we're trying to fix the problem and it might be fixed in a future G2 version.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2005-05-15 17:00

fix in cvs; update in a few hours or get tomorrow's nightly snapshot.

 
rvermaat

Joined: 2005-01-22
Posts: 6
Posted: Mon, 2005-05-16 12:23

Updated to the latest cvs and now everything works fine again