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.
The code reads:
function set($cid, $data, $expire = CACHE_PERMANENT) {
$filename = $this->prefix . $this->encode_cid($cid);
// Open file for that entry, handling errors that may arise
$fh = @fopen($filename, 'r+b');
if ($fh === FALSE) {
// If file doesn't exist, create it with a+w permissions
$fh = fopen($filename, 'c+b');
if ($fh !== FALSE) {
if (!chmod($filename, 0777)) {
The second comment states "create it with a+w permissions". Then it's opened with "c+b". Shouldn't it be "a+b" to create it for binary read-write access?
Comments
Comment #1
ogi CreditAttribution: ogi commenteda+w
is about access mode (the 0777 later in the code that in a recent commit was changed to 0666).c+b
is for fopen mode (open binary file and create it if needed) and is the correct one.