mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-09-04 06:32:42 +00:00
Removed trim() from QRCode->getMatrix(). Data sanitization should be done outside.
This commit is contained in:
Regular → Executable
+2
-1
@@ -161,7 +161,8 @@ class QRCode{
|
||||
* @throws \chillerlan\QRCode\Data\QRCodeDataException
|
||||
*/
|
||||
public function getMatrix(string $data):QRMatrix {
|
||||
$data = trim($data);
|
||||
//NOTE: data sanitation should be done outside
|
||||
//$data = trim($data);
|
||||
|
||||
if(empty($data)){
|
||||
throw new QRCodeDataException('QRCode::getMatrix() No data given.');
|
||||
|
||||
Regular → Executable
+7
@@ -94,6 +94,13 @@ class QRCodeTest extends QRTestAbstract{
|
||||
$this->qrcode->getMatrix('');
|
||||
}
|
||||
|
||||
public function testTrim() {
|
||||
$m1 = $this->qrcode->getMatrix('hello');
|
||||
$m2 = $this->qrcode->getMatrix('hello '); // added space
|
||||
|
||||
$this->assertNotEquals($m1, $m2);
|
||||
}
|
||||
|
||||
public function testImageTransparencyBGDefault(){
|
||||
$this->qrcode = $this->reflection->newInstanceArgs([new QROptions(['imageTransparencyBG' => 'foo'])]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user