Write variables in session file

@return void
760326
private function write()
    {
        ftruncate($this->handle, 0);
        rewind($this->handle);

        fwrite($this->handle, serialize($this->data));
    }
470889
private void write(IoSession session, IoBuffer data) {
        IoBuffer dest = buffersMap.putIfAbsent(session,
                new IoBufferLazyInitializer(bufferSize));

        write(session, data, dest);
    }
1025788
public function write()
    {
        $stats = array('hits' => $this->hits, 'misses' => $this->misses);

        file_put_contents($this->getFilename(), serialize($stats));
    }
754852
public function write($file = "")
    {
        $iniString = $this->generateIniString($this->config);
        file_put_contents($file ? $file : $this->filePath, $iniString);
    }
1208448
private function writeColumns(): void
  {
    $content = '';
    foreach ($this->columns as $table)
    {
      $width1 = 0;
      $width2 = 0;
      foreach ($table as $column)
      {
        $width1 = max(mb_strlen($column['column_name']), $width1);
        $width2 = max(mb_strlen((string)$column['length']), $width2);
      }

      foreach ($table as $column)
      {
        if (isset($column['length']))
        {
          if (isset($column['constant_name']))
          {
            $line_format = sprintf("%%s.%%-%ds %%%dd %%s\n", $width1, $width2);
            $content     .= sprintf($line_format,
                                    $column['table_name'],
                                    $column['column_name'],
                                    $column['length'],
                                    $column['constant_name']);
          }
          else
          {
            $line_format = sprintf("%%s.%%-%ds %%%dd\n", $width1, $width2);
            $content     .= sprintf($line_format,
                                    $column['table_name'],
                                    $column['column_name'],
                                    $column['length']);
          }
        }
      }

      $content .= "\n";
    }

    // Save the columns, width and constants to the filesystem.
    $this->writeTwoPhases($this->constantsFilename, $content);
  }
458557
def _write_session(self):
        
        base_name = "%ssession" % self._product_accronym.lower()
        filename = "%s%s.py" % (self._class_prefix.lower(), base_name)
        override_content = self._extract_override_content(base_name)

        self.write(destination=self.output_directory, filename=filename, template_name="session.py.tpl",
                   version=self.api_version,
                   product_accronym=self._product_accronym,
                   class_prefix=self._class_prefix,
                   root_api=self.api_root,
                   api_prefix=self.api_prefix,
                   override_content=override_content,
                   header=self.header_content)
754384
public function write($file = "")
    {
        $envString = $this->generateEnvString($this->lines);
        file_put_contents($file ? $file : $this->filePath, $envString);
    }
650552
public static function processMagicVariables() {
		$variables_object = new \Object\Magic\Variables();
		$variables = $variables_object->get();
		$input = \Request::input(null, true, true);
		foreach ($variables as $k => $v) {
			if (!array_key_exists($k, $input)) {
				self::$settings['flag']['global'][$k] = null;
				continue;
			}
			if ($k == '__content_type') {
				$object = new \Object\Content\Types();
				$data = $object->get();
				if (isset($data[$input[$k]])) {
					self::$settings['flag']['global'][$k] = $input[$k];
				}
			} else {
				self::$settings['flag']['global'][$k] = $input[$k];
			}
		}
	}
927983
public static function var_dump() {
        global $USER, $CONTEXT, $LINK, $RESULT;
        echo('$USER:'."\n");
        if ( ! isset($USER) ) {
            echo("Not set\n");
        } else {
            var_dump($USER);
        }
        echo('$CONTEXT:'."\n");
        if ( ! isset($CONTEXT) ) {
            echo("Not set\n");
        } else {
            var_dump($CONTEXT);
        }
        echo('$LINK:'."\n");
        if ( ! isset($LINK) ) {
            echo("Not set\n");
        } else {
            var_dump($LINK);
        }
        echo('$RESULT:'."\n");
        if ( ! isset($RESULT) ) {
            echo("Not set\n");
        } else {
            var_dump($RESULT);
        }
        echo("\n<hr/>\n");
    }
567406
public function backupRequestVariables()
    {
        $this->requestCache['_SERVER'] = $_SERVER;
        $this->requestCache['_POST'] = $_POST;
        $this->requestCache['_GET'] = $_GET;
        $this->requestCache['_SESSION'] = $_SESSION;
        $this->requestCache['_COOKIE'] = $_COOKIE;
    }
337283
protected function writeFile()
    {
        //  Routes are writable, apparently, give it a bash
        $sData = '<?php' . "\n\n";
        $sData .= '/**' . "\n";
        $sData .= ' * THIS FILE IS CREATED/MODIFIED AUTOMATICALLY' . "\n";
        $sData .= ' * ===========================================' . "\n";
        $sData .= ' *' . "\n";
        $sData .= ' * Any changes you make in this file will be overwritten the' . "\n";
        $sData .= ' * next time the app routes are generated.' . "\n";
        $sData .= ' *' . "\n";
        $sData .= ' * See Nails docs for instructions on how to utilise the' . "\n";
        $sData .= ' * routes_app.php file' . "\n";
        $sData .= ' *' . "\n";
        $sData .= ' **/' . "\n\n";

        // --------------------------------------------------------------------------

        foreach ($this->aRoutes as $sKey => $sValue) {
            if (preg_match('#^//.*$#', $sKey)) {
                //  This is a comment
                $sData .= $sKey . "\n";
            } else {
                //  This is a route
                $sData .= '$route[\'' . $sKey . '\']=\'' . $sValue . '\';' . "\n";
            }
        }

        $oDate = Factory::factory('DateTime');
        $sData .= "\n" . '//LAST GENERATED: ' . $oDate->format('Y-m-d H:i:s');
        $sData .= "\n";

        // --------------------------------------------------------------------------

        $fHandle = @fopen(static::ROUTES_DIR . static::ROUTES_FILE, 'w');

        if (!$fHandle) {
            $this->setError('Unable to open routes file for writing.');
            return false;
        }

        if (!fwrite($fHandle, $sData)) {
            fclose($fHandle);
            $this->setError('Unable to write data to routes file.');
            return false;
        }

        fclose($fHandle);
        return true;
    }
329194
private function saveFile(): void
    {
        $sourceCode = Helpers::tabsToSpaces((string) $this->entityFile);
        $entityPath = dirname(__DIR__, 7) . '/src/' . $this->entityData['namespace'] . '/';

        $handle = fopen($entityPath . $this->entityData['class'] . '.php', 'w');
        fwrite($handle, $sourceCode);
        fclose($handle);
    }
118698
public function save(): void
        {
            if ($this->active() && session_name() == $this->name()) {
                $_SESSION = $this->all();
                session_write_close();
            }
        }
1286045
public function write(): void
	{
		global $mid;

		$this->tabControl = new CAdminTabControl('tabControl', $this->options->getTabs());

		$fields = $this->options->getFields();

		$this->tabControl->begin();
		?>
		<form
			method="post"
			action="<?= sprintf('%s?mid=%s&lang=%s', $this->getRequest()->getRequestedPage(), urlencode($mid), LANGUAGE_ID) ?>"
			name="<?= $this->formId ?>"
			id="<?= $this->formId ?>"
		>
			<?php
			echo bitrix_sessid_post();
			foreach ($this->tabControl->tabs as $tab) {
				$this->tabControl->beginNextTab();
				$filteredOpts = array_filter($fields, function ($opt) use ($tab) {
					return $opt['tab'] === $tab['DIV'];
				});
				foreach ($filteredOpts as $opt_name => $opt) { ?>
					<tr id="<?= $opt_name ?>_row">
						<?php
						switch ($opt['type']) {
							case 'html':
								if ($opt['label'] !== '') {
									?>
									<td width="30%" style="vertical-align: top; line-height: 25px;">
										<label for="<?= $opt_name ?>">
											<?= $opt['label'] . ($opt['required'] ? ' *' : '') ?>:
										</label>
									</td>
									<td width="70%">
									<?php
								} else {
									?>
									<td colspan="2">
									<?php
								}

								if ($opt['html']) {
									echo $opt['html'];
								} else if (file_exists($opt['path'])) {
									/** @noinspection PhpIncludeInspection */
									include $opt['path'];
								}
								?>
								</td>
								<?php
								break;

							default:
								?>
								<td width="30%" style="vertical-align: top; line-height: 25px;">
									<label for="<?= $opt_name ?>">
										<?= $opt['label'] . ($opt['required'] ? ' *' : '') ?>:
									</label>
								</td>
								<td width="70%">
									<?php
									switch ($opt['type']) {
										case 'select':
											?>
											<select
												name="<?= $opt_name ?>"
												id="<?= $opt_name ?>"
												<?= $opt['required'] ? 'required="required"' : '' ?>
											>
												<option
													value=""
													<?= $opt['required'] ? ' disabled' : '' ?>
													<?= !Option::get(ADMIN_MODULE_NAME, $opt_name, $opt['default']) ? 'selected="selected"' : '' ?>
												>-</option>
												<?php foreach ($opt['values'] as $value => $display) { ?>
													<option
														value="<?= $value ?>"
														<?= Option::get(ADMIN_MODULE_NAME, $opt_name, $opt['default']) == $value ? 'selected="selected"' : '' ?>
													><?= $display ?></option>
												<?php } ?>
											</select>
											<?php
											break;

										case 'checkbox':
											?>
											<input
												type="<?= $opt['type'] ?>"
												name="<?= $opt_name ?>"
												id="<?= $opt_name ?>"
												<?= Option::get(ADMIN_MODULE_NAME, $opt_name) ? 'checked="checked"' : '' ?>
												<?= $opt['required'] ? 'required="required"' : '' ?>
											/>
											<?php
											break;

										case 'textarea':
											?>
											<textarea
												cols="<?= $opt['cols'] ?: '80' ?>"
												rows="<?= $opt['rows'] ?: '20' ?>"
												name="<?= $opt_name ?>"
												id="<?= $opt_name ?>"
												<?= $opt['required'] ? 'required="required"' : '' ?>
												<?= $opt['placeholder'] ? 'placeholder="' . htmlspecialchars($opt['placeholder']) . '"' : '' ?>
											><?= htmlspecialchars(Option::get(ADMIN_MODULE_NAME, $opt_name, $opt['default'])); ?></textarea>
											<?php
											break;

										case 'text':
										default:
											?>
											<input
												type="<?= $opt['type'] ?>"
												size="<?= $opt['size'] ?: '50' ?>"
												name="<?= $opt_name ?>"
												id="<?= $opt_name ?>"
												value="<?= htmlspecialchars(Option::get(ADMIN_MODULE_NAME, $opt_name)); ?>"
												<?= $opt['required'] ? 'required="required"' : '' ?>
												<?= $opt['placeholder'] ? 'placeholder="' . htmlspecialchars($opt['placeholder']) . '"' : '' ?>
											/>
											<?php
											break;
									}
									?>
									<?= $opt['description'] ? '<p>' . $opt['description'] . '</p>' : '' ?>
								</td>
								<?php
								break;
						} ?>
					</tr>
				<?php }
			}

			$this->tabControl->buttons();
			?>
			<input
				type="submit"
				name="save"
				value="<?= Loc::getMessage('MAIN_SAVE') ?>"
				title="<?= Loc::getMessage('MAIN_OPT_SAVE_TITLE') ?>"
				class="adm-btn-save"
			/>

			<input
				type="submit"
				name="restore"
				title="<?= Loc::getMessage('MAIN_HINT_RESTORE_DEFAULTS') ?>"
				onclick="return confirm('<?= addslashes(GetMessage('MAIN_HINT_RESTORE_DEFAULTS_WARNING')) ?>')"
				value="<?= Loc::getMessage('MAIN_RESTORE_DEFAULTS') ?>"
			/>
			<?php
			$this->tabControl->end();
			?>
		</form>
		<?php
	}
557827
static function write($key,$value){
	
		$segments = self::engineName($key);
		$file = [implode($segments->file,'.')];
		
		// set key data
		$keys = array_merge($file,$segments->keys);
		
		// update config data
		self::$data = array_replace_recursive(
			self::$data ,
			self::_makeDimensional($keys,$value)
		);
	}
306404
public function write($session_id, $session_data)
    {
        $this->sessions[$session_id] = [
            'time' => $this->createTimestamp(),
            'data' => $session_data
        ];

        return true;
    }
558117
def _write(self, session, openFile, replaceParamFile):
        
        # Retrieve TargetParameter objects
        targets = self.targetParameters

        # Write lines
        openFile.write('%s\n' % self.numParameters)

        for target in targets:
            openFile.write('%s %s\n' % (target.targetVariable, target.varFormat))