The below error is caught and logged into my Nginx error log:
*962 FastCGI sent in stderr: "PHP message: PHP Fatal error: __clone method called on non-object in /var/www/xxx/sites/all/modules/token/token.tokens.inc on line 1403" while reading response header from upstream, client: my-own-ip, server: xxx.com, request: "GET /world HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xxx.com", referrer: "http://xxx.com/user"
I get the same on-screen error when I put the same site on Apache:
Fatal error: __clone method called on non-object in /var/www/xxx/sites/all/modules/token/token.tokens.inc on line 1403
I have tested token version 7.x-1.5, 1.5-dev and 1.4. All of them give the same fatal error.
Once I disabled the module, the fatal error is gone.
Line 1403 of token.tokens.inc is:
$entity = clone $data['entity'];
So I'd tried to print_r($data['entity']
just before this statement to check what is it. The following is the output:
stdClass Object ( [fid] => 392 [uid] => 83 [filename] => picture-83-1357192371.jpg [uri] => public://pictures/picture-83-1357192371.jpg [filemime] => image/jpeg [filesize] => 70559 [status] => 1 [timestamp] => 1357192371 [type] => image [field_file_image_alt_text] => Array ( ) [field_file_image_title_text] => Array ( ) [rdf_mapping] => Array ( ) [metadata] => Array ( ) ) stdClass Object ( [fid] => 392 [uid] => 83 [filename] => picture-83-1357192371.jpg [uri] => public://pictures/picture-83-1357192371.jpg [filemime] => image/jpeg [filesize] => 70559 [status] => 1 [timestamp] => 1357192371 [type] => image [field_file_image_alt_text] => Array ( ) [field_file_image_title_text] => Array ( ) [rdf_mapping] => Array ( ) [metadata] => Array ( ) [alt] => ) 631
I tried to tidy up this output as below:
stdClass Object (
[fid] => 392
[uid] => 83
[filename] => picture-83-1357192371.jpg
[uri] => public://pictures/picture-83-1357192371.jpg
[filemime] => image/jpeg
[filesize] => 70559
[status] => 1
[timestamp] => 1357192371
[type] => image
[field_file_image_alt_text] => Array ( ) [field_file_image_title_text]
=> Array ( ) [rdf_mapping]
=> Array ( ) [metadata]
=> Array ( )
)
stdClass Object (
[fid] => 392
[uid] => 83
[filename] => picture-83-1357192371.jpg
[uri] => public://pictures/picture-83-1357192371.jpg
[filemime] => image/jpeg
[filesize] => 70559
[status] => 1
[timestamp] => 1357192371
[type] => image
[field_file_image_alt_text] => Array ( ) [field_file_image_title_text]
=> Array ( ) [rdf_mapping]
=> Array ( ) [metadata]
=> Array ( ) [alt]
=>
) 631
Comments
Comment #1
metakel CreditAttribution: metakel commentedI think it may not caused by the Token module, but rather by the fbsmp module, as in this issue:
#2168761: Attaching image results in PHP fatal error
Comment #3
kenorb CreditAttribution: kenorb commentedNote: This error is usually related when passing empty or invalid entity argument into token_replace() or similar function.