When viewing a commerce product page I see the following error, but only when logged in.
Notice: Array to string conversion in /sites/all/modules/performance/authcache/modules/authcache_p13n/frontcontroller/authcache.php on line 23
but when looking at the error log I'm seeing a different error for the same page
Warning: Cannot modify header information - headers already sent by (output started at /sites/all/modules/performance/authcache/modules/authcache_p13n/frontcontroller/authcache.php:23) in drupal_send_headers() (line 1221 of /includes/bootstrap.inc).
I afraid I don't even know where to begin to identify what's causing this.
Comment | File | Size | Author |
---|---|---|---|
#4 | authcache-patch.diff | 913 bytes | ryan88 |
Comments
Comment #1
znerol CreditAttribution: znerol commentedUh, this is weird. Looking at the source I cannot really tell what happens. Could you give some more information on the server software you are using, as well as on the PHP version?
The relevant part from the authcache.php frontcontroller script:
The array-to-string warning origins at the line 23, however the only array parameter there is
$_SERVER
. Also preg_replace should operate on arrays even when$pattern
and$replacement
parameters are strings.If you find the root cause which results in this warning, I'd be very interested in knowing about.
If you run into this on a production system, I recommend to use the safe_frontcontroller/authcache.php script instead. Copy it to the drupal root directory and follow the instructions given in the docblock. This will eliminate the need to dynamically discover the root directory and tamper with
$_SERVER
global completely.Comment #2
znerol CreditAttribution: znerol commentedComment #3
Mario Baron CreditAttribution: Mario Baron commentedI am getting the same error. I tried implementing:
but, I had no luck and Notice is still showing.
I am using MAMP localhost
Server info:
Apache
PHP 5.3.27
Comment #4
ryan88 CreditAttribution: ryan88 commentedI don't really know why the error is happening, but to make it go away, I looped through the $_SERVER variable and did the replace on each item. I attached a patch if interested.
Comment #5
znerol CreditAttribution: znerol commented@ryan88: Very interesting. This indicates that under some circumstances there can be an entry on the
$_SERVER
variable which is not a string but an array. Can you identify the entry which causes this notice?According to the PHP documentation, the
argv
key contains an array, but it should only be present when running from the command line (see this SO answer).Do you have the
vars
-entry on your$_SERVER
or is it something different?Comment #6
harrrrrrr CreditAttribution: harrrrrrr commentedI have the same problem when running on local MAMP stack, I tried on 5.3.20 & 5.4.10.
Here is the dump you've asked, the array is indeed in 'argv':
Comment #8
znerol CreditAttribution: znerol commentedFixed, thank you.