New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test for null byte #56
Conversation
@@ -55,6 +56,18 @@ public function testConnection(): void | |||
$this->db->query('SELECT GETDATE() AS CurrentDateTime')->execute(); | |||
} | |||
|
|||
private function stripNulls(string $fileName): void | |||
{ | |||
$process = new Process(sprintf('sed -e \'s/,\x00,/,,/\' -i %s', $fileName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not trust myself with escaping, which is why I would use argument array
// traditional string based commands
$builder = new Process('ls -lsa');
// same example but using an array
$builder = new Process(array('ls', '-lsa'));
// the array can contain any number of arguments and options
$builder = new Process(array('ls', '-l', '-s', '-a'));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also definitely needs a comment to explain what it does and why
@@ -55,6 +56,18 @@ public function testConnection(): void | |||
$this->db->query('SELECT GETDATE() AS CurrentDateTime')->execute(); | |||
} | |||
|
|||
private function stripNulls(string $fileName): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stripNullBytesInEmptyFields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally move outside the class and test it in isolation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but cant approve because i opened the PR :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;p
No description provided.