Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
With new PHP version a call to this module ends with
PHP Fatal error: Cannot re-assign auto-global variable _COOKIE
because of this PHP regression.
This problem can be easily resolved with renaming local variable $_COOKIE to something not conflicting with superglobal variables like
function __construct($global_cookie) { // changed from function __construct($_COOKIE) and so on in whole function body
if (isset($global_cookie["__utmz"])) {
$this->utmz = $global_cookie["__utmz"];
}
if (isset($global_cookie["__utma"])) {
$this->utma = $global_cookie["__utma"];
}
$this->ParseCookies();
}
Comment | File | Size | Author |
---|---|---|---|
#4 | 1658024-4-php_5.4_globals_regression.patch | 656 bytes | fenstrat |
Comments
Comment #1
iStryker CreditAttribution: iStryker commentedThis is a duplication of #1198504: Deprecated split function used in gaparse class. In 5.3 its deprecated, 5.4 its removed.
Comment #2
ondra.knezour CreditAttribution: ondra.knezour commentedChanged title to be more descriptive. Please consider reading summary before your next action on issue, it is there for reason.
Comment #3
iStryker CreditAttribution: iStryker commentedCreate a patch then
Comment #4
fenstratWell tracked down @ondra.knezour
$cookies
seems like the logical replacement. This fixes the error for me with PHP 5.4.Comment #5
DickSwart CreditAttribution: DickSwart commentedPatch worked for me thanx
Comment #6
Brian294 CreditAttribution: Brian294 commentedThank you. Committed to 7.x branch. Will create a 7.4 version after the next git repo refresh.
Peace,
Brian
Comment #7
fenstratThanks Brian.
When committing patches from other in the future please have a look Adding a commit author to help pay it forward.
Comment #8
ARUN AK CreditAttribution: ARUN AK commentedPatch worked for me. Thank you.
1658024-4-php_5.4_globals_regression.patch
Comment #9
themic8 CreditAttribution: themic8 commentedThe patch also worked for me, 1658024-4-php_5.4_globals_regression.patch
Comment #10
zkent CreditAttribution: zkent commentedThis patch (#4) worked for me also. I was setting up a local development copy of a working site and thought I was going nuts.