Merge branch '2.8' into 3.4
* 2.8: Added the Code of Conduct file [Process] fix locking of pipe files on Windows fix multi-digit seconds fraction handling
This commit is contained in:
commit
af2938eac4
83
CODE_OF_CONDUCT.md
Normal file
83
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
Code of Conduct
|
||||||
|
===============
|
||||||
|
|
||||||
|
Our Pledge
|
||||||
|
----------
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnic origin, gender identity and expression, level of
|
||||||
|
experience, education, socio-economic status, nationality, personal appearance,
|
||||||
|
religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
Our Standards
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
Our Responsibilities
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
[CoC Active Response Ensurers, or CARE][1], are responsible for clarifying the
|
||||||
|
standards of acceptable behavior and are expected to take appropriate and fair
|
||||||
|
corrective action in response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
CARE team members have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, or to ban temporarily or permanently any
|
||||||
|
contributor for other behaviors that they deem inappropriate, threatening,
|
||||||
|
offensive, or harmful.
|
||||||
|
|
||||||
|
Scope
|
||||||
|
-----
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by CARE team members.
|
||||||
|
|
||||||
|
Enforcement
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior
|
||||||
|
[may be reported][2] by contacting the [CARE team members][1].
|
||||||
|
All complaints will be reviewed and investigated and will result in a response
|
||||||
|
that is deemed necessary and appropriate to the circumstances. The CARE team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an
|
||||||
|
incident. Further details of specific enforcement policies may be posted
|
||||||
|
separately.
|
||||||
|
|
||||||
|
CARE team members who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by the
|
||||||
|
[core team][3].
|
||||||
|
|
||||||
|
Attribution
|
||||||
|
-----------
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant version 1.4][4].
|
||||||
|
|
||||||
|
[1]: https://symfony.com/doc/current/contributing/code_of_conduct/care_team.html
|
||||||
|
[2]: https://symfony.com/doc/current/contributing/code_of_conduct/reporting_guidelines.html
|
||||||
|
[3]: https://symfony.com/doc/current/contributing/code/core_team.html
|
||||||
|
[4]: https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
@ -68,7 +68,7 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) {
|
if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) {
|
||||||
throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339));
|
throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ class DateTimeToRfc3339TransformerTest extends TestCase
|
|||||||
array('UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05Z'),
|
array('UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05Z'),
|
||||||
array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05+08:00'),
|
array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05+08:00'),
|
||||||
array('Europe/Amsterdam', 'Europe/Amsterdam', '2013-08-21 10:30:00 Europe/Amsterdam', '2013-08-21T08:30:00Z'),
|
array('Europe/Amsterdam', 'Europe/Amsterdam', '2013-08-21 10:30:00 Europe/Amsterdam', '2013-08-21T08:30:00Z'),
|
||||||
|
array('UTC', 'UTC', '2018-10-03T10:00:00.000Z', '2018-10-03T10:00:00.000Z'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class WindowsPipes extends AbstractPipes
|
|||||||
{
|
{
|
||||||
private $files = array();
|
private $files = array();
|
||||||
private $fileHandles = array();
|
private $fileHandles = array();
|
||||||
|
private $lockHandles = array();
|
||||||
private $readBytes = array(
|
private $readBytes = array(
|
||||||
Process::STDOUT => 0,
|
Process::STDOUT => 0,
|
||||||
Process::STDERR => 0,
|
Process::STDERR => 0,
|
||||||
@ -47,31 +48,33 @@ class WindowsPipes extends AbstractPipes
|
|||||||
Process::STDOUT => Process::OUT,
|
Process::STDOUT => Process::OUT,
|
||||||
Process::STDERR => Process::ERR,
|
Process::STDERR => Process::ERR,
|
||||||
);
|
);
|
||||||
$tmpCheck = false;
|
|
||||||
$tmpDir = sys_get_temp_dir();
|
$tmpDir = sys_get_temp_dir();
|
||||||
$lastError = 'unknown reason';
|
$lastError = 'unknown reason';
|
||||||
set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
|
set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
|
||||||
for ($i = 0;; ++$i) {
|
for ($i = 0;; ++$i) {
|
||||||
foreach ($pipes as $pipe => $name) {
|
foreach ($pipes as $pipe => $name) {
|
||||||
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
|
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
|
||||||
if (file_exists($file) && !unlink($file)) {
|
|
||||||
continue 2;
|
if (!$h = fopen($file.'.lock', 'w')) {
|
||||||
}
|
|
||||||
$h = fopen($file, 'xb');
|
|
||||||
if (!$h) {
|
|
||||||
$error = $lastError;
|
|
||||||
if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
|
throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
|
||||||
}
|
}
|
||||||
if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
|
if (!flock($h, LOCK_EX | LOCK_NB)) {
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
if (isset($this->files[$pipe])) {
|
if (isset($this->lockHandles[$pipe])) {
|
||||||
unlink($this->files[$pipe]);
|
flock($this->lockHandles[$pipe], LOCK_UN);
|
||||||
|
fclose($this->lockHandles[$pipe]);
|
||||||
}
|
}
|
||||||
|
$this->lockHandles[$pipe] = $h;
|
||||||
|
|
||||||
|
if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
|
||||||
|
flock($this->lockHandles[$pipe], LOCK_UN);
|
||||||
|
fclose($this->lockHandles[$pipe]);
|
||||||
|
unset($this->lockHandles[$pipe]);
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
$this->fileHandles[$pipe] = $h;
|
||||||
$this->files[$pipe] = $file;
|
$this->files[$pipe] = $file;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -85,7 +88,6 @@ class WindowsPipes extends AbstractPipes
|
|||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
$this->close();
|
$this->close();
|
||||||
$this->removeFiles();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,8 +147,11 @@ class WindowsPipes extends AbstractPipes
|
|||||||
$read[$type] = $data;
|
$read[$type] = $data;
|
||||||
}
|
}
|
||||||
if ($close) {
|
if ($close) {
|
||||||
|
ftruncate($fileHandle, 0);
|
||||||
fclose($fileHandle);
|
fclose($fileHandle);
|
||||||
unset($this->fileHandles[$type]);
|
flock($this->lockHandles[$type], LOCK_UN);
|
||||||
|
fclose($this->lockHandles[$type]);
|
||||||
|
unset($this->fileHandles[$type], $this->lockHandles[$type]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,22 +180,12 @@ class WindowsPipes extends AbstractPipes
|
|||||||
public function close()
|
public function close()
|
||||||
{
|
{
|
||||||
parent::close();
|
parent::close();
|
||||||
foreach ($this->fileHandles as $handle) {
|
foreach ($this->fileHandles as $type => $handle) {
|
||||||
|
ftruncate($handle, 0);
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
flock($this->lockHandles[$type], LOCK_UN);
|
||||||
|
fclose($this->lockHandles[$type]);
|
||||||
}
|
}
|
||||||
$this->fileHandles = array();
|
$this->fileHandles = $this->lockHandles = array();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes temporary files.
|
|
||||||
*/
|
|
||||||
private function removeFiles()
|
|
||||||
{
|
|
||||||
foreach ($this->files as $filename) {
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
@unlink($filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->files = array();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user