ernie-research/MEnvData-SWE huggingface dataset:
Repository: codeigniter4/CodeIgniter4 (PHP)

Issue:
Bug: PHP 8.1 Images\Handlers\GDHandler Implicit conversion from float to int loses precision
See https://forum.codeigniter.com/showthread.php?tid=81803

```
ErrorException

Implicit conversion from float 63.5 to int loses precision [search →](https://www.duckduckgo.com/?q=ErrorException+Implicit+conversion+from+float+63.5+to+int+loses+precision)

SYSTEMPATH/Images/Handlers/GDHandler.php at line 467
```

```php
<?php
namespace App\Controllers;
class Home extends BaseController
{
    public function index()
    {
        \Config\Services::image('gd')
            ->withFile(WRITEPATH . 'img.png')
            ->text('Copyright 2017 My Photo Co', [
                'color'      => '#fff',
                'opacity'    => 0.5,
                'withShadow' => true,
                'hAlign'    => 'center',
                'vAlign'    => 'bottom',
                'fontSize'  => 20
            ])
            ->save(WRITEPATH . 'img2.png');
    }
}
```



Discussion:

Patch:
diff --git a/system/Images/Handlers/GDHandler.php b/system/Images/Handlers/GDHandler.php
index ab8e0b7e3dd3..e35fc726948a 100644
--- a/system/Images/Handlers/GDHandler.php
+++ b/system/Images/Handlers/GDHandler.php
@@ -451,7 +451,7 @@ protected function textOverlay(string $text, array $options = [], bool $isShadow
          * Get the rest of the string and split it into 2-length
          * hex values:
          */
-        $opacity = ($options['opacity'] * 127);
+        $opacity = (int) ($options['opacity'] * 127);
 
         // Allow opacity to be applied to the text
         imagealphablending($src, true);


Test patch:
diff --git a/tests/system/Images/GDHandlerTest.php b/tests/system/Images/GDHandlerTest.php
index 30216725a988..7661004ca2d4 100644
--- a/tests/system/Images/GDHandlerTest.php
+++ b/tests/system/Images/GDHandlerTest.php
@@ -289,7 +289,10 @@ public function testFitPositions()
     public function testText()
     {
         $this->handler->withFile($this->path);
-        $this->handler->text('vertical', ['hAlign' => 'right', 'vAlign' => 'bottom']);
+        $this->handler->text(
+            'vertical',
+            ['hAlign' => 'right', 'vAlign' => 'bottom', 'opacity' => 0.5]
+        );
         $this->assertSame(155, $this->handler->getWidth());
         $this->assertSame(200, $this->handler->getHeight());
     }
Repository: codeigniter4/CodeIgniter4 (PHP)

Issue:
Bug: db query '?' bind is not working when use sql with ':=' operator.
**Describe the bug**
Database Query '?' Bind is not working when use sql with ':=' operator.

**CodeIgniter 4 version**
v4.0.2

**Affected module(s)**
CodeIgniter\Database\Query (system/Database/Query.php)

**Expected behavior, and steps to reproduce if appropriate**

i use MySQL 5.7.28 and MySQLi driver.

> $db = db_connect();
> $sql = 'SELECT @factorA := ?, @factorB := ?';
> $params = [1,2];
> $db->query($sql, $params);

i expected run query.
`SELECT @factorA := 1, @factorB := 2`.

but it was run query actually
`SELECT @factorA := ?, @factorB := ?`
and occured SQL syntax error.

it seem to understand NamedBind because the sql has ':=' operator.
so i fix ci4 code temporarily.

system/Database/Query.php :: compileBinds() line 371
> $hasNamedBinds = strpos($sql, ':=') === false && strpos($sql, ':') !== false;

i hope solve this problem.
thanks.

**Context**
 - OS: CentOS Linux release 8.1.1911
 - Web server: nginx/1.17.6
 - PHP version: 7.4.3 (php-fpm)


Discussion:
Let me have a look



Patch:
diff --git a/system/Database/Query.php b/system/Database/Query.php
index 650a7da93193..dae2eeb11849 100644
--- a/system/Database/Query.php
+++ b/system/Database/Query.php
@@ -368,7 +368,7 @@ protected function compileBinds()
 	{
 		$sql = $this->finalQueryString;
 
-		$hasNamedBinds = strpos($sql, ':') !== false;
+		$hasNamedBinds = strpos($sql, ':') !== false && strpos($sql, ':=') === false;
 
 		if (empty($this->binds) || empty($this->bindMarker) ||
 				(strpos($sql, $this->bindMarker) === false &&


Test patch:
diff --git a/tests/system/Database/BaseQueryTest.php b/tests/system/Database/BaseQueryTest.php
index 7a92467c3618..4e09d49ccc24 100644
--- a/tests/system/Database/BaseQueryTest.php
+++ b/tests/system/Database/BaseQueryTest.php
@@ -316,4 +316,23 @@ public function testSetQueryBindsWithSetEscapeFalse()
 
 		$this->assertEquals($expected, $query->getQuery());
 	}
+
+	/**
+	 * @see https://github.com/codeigniter4/CodeIgniter4/issues/2762
+	 */
+	public function testSetQueryBinds()
+	{
+		$query = new Query($this->db);
+
+		$binds = [
+			1,
+			2,
+		];
+
+		$query->setQuery('SELECT @factorA := ?, @factorB := ?', $binds);
+
+		$expected = 'SELECT @factorA := 1, @factorB := 2';
+
+		$this->assertEquals($expected, $query->getQuery());
+	}
 }
Repository: EasyCorp/EasyAdminBundle (PHP)

Issue:
[3.2.8] Crud::addformTheme adds the custom theme with low priority
**Describe the bug**
The following code works in terms of logic, but displays incorrectly in symfony 4.4:
```php
// in DashboardController.php
    public function configureCrud(): Crud
    {
        return parent::configureCrud()
            ->addFormTheme('admin/ea/theme.twig');
    }
```
Since the in the addFormTheme function it says in the comment
```
// custom form themes are added first to give them more priority
```
Yet symfony and twig bundle actually care about the _last_ theme more, so your changes are never visible unless you actually run setTheme and re-add the main one.

addFormTheme shouldn't push it to the front of the theme array.

Symfony 4.4.21
EA 3.2.8



Discussion:

Patch:
diff --git a/src/Config/Crud.php b/src/Config/Crud.php
index 2f7d28c738..3a8a1be860 100644
--- a/src/Config/Crud.php
+++ b/src/Config/Crud.php
@@ -286,10 +286,8 @@ public function overrideTemplates(array $templateNamesAndPaths): self
 
     public function addFormTheme(string $themePath): self
     {
-        // custom form themes are added first to give them more priority
-        $formThemes = $this->dto->getFormThemes();
-        array_unshift($formThemes, $themePath);
-        $this->dto->setFormThemes($formThemes);
+        // custom form themes are added last to give them more priority
+        $this->dto->setFormThemes(array_merge($this->dto->getFormThemes(), [$themePath]));
 
         return $this;
     }


Test patch:
diff --git a/tests/Config/CrudTest.php b/tests/Config/CrudTest.php
new file mode 100644
index 0000000000..0aa98b072f
--- /dev/null
+++ b/tests/Config/CrudTest.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace EasyCorp\Bundle\EasyAdminBundle\Tests\Config;
+
+use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
+use PHPUnit\Framework\TestCase;
+
+class CrudTest extends TestCase
+{
+    public function testAddFormTheme()
+    {
+        $crudConfig = Crud::new();
+        $crudConfig->addFormTheme('admin/form/my_theme.html.twig');
+
+        $this->assertSame(['@EasyAdmin/crud/form_theme.html.twig', 'admin/form/my_theme.html.twig'], $crudConfig->getAsDto()->getFormThemes());
+    }
+
+    public function testSetFormThemes()
+    {
+        $crudConfig = Crud::new();
+        $crudConfig->setFormThemes(['common/base_form_theme.html.twig', 'admin/form/my_theme.html.twig']);
+
+        $this->assertSame(['common/base_form_theme.html.twig', 'admin/form/my_theme.html.twig'], $crudConfig->getAsDto()->getFormThemes());
+    }
+}
Repository: jumbojett/OpenID-Connect-PHP (PHP)

Issue:
\Jumbojett\OpenIDConnectClient::$leeway is not overrideable
The value for `\Jumbojett\OpenIDConnectClient::$leeway` is fixated to 300 seconds. Although exposed outwards using `\Jumbojett\OpenIDConnectClient::getLeeway()` there is no way to manipulate the value for leeway. 

Is this deliberate? We are in control of all of our servers and we are interested in lowering the leeway. I think that there are three ways to do this without too much changes codewise:
1. Make `\Jumbojett\OpenIDConnectClient::$leeway` protected
2. Introduce a public or protected `\Jumbojett\OpenIDConnectClient::setLeeway()` method
3. Use `\Jumbojett\OpenIDConnectClient::getLeeway()` internally

So my questions:
- Are you open to allow adjusting the leeway?
- If so, do you prefer one of the proposed solutions?
- If so, do you want me to create a pull request for this?


Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee24d509..79a868b6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [unreleased]
 
+### Added
+- Support to change the `leeway` time for JWT verification using `setLeeway` #483
+
 ### Changed
 - Stop adding ?schema=openid to userinfo endpoint URL. #449
 
diff --git a/src/OpenIDConnectClient.php b/src/OpenIDConnectClient.php
index 32001612..942bc8cb 100644
--- a/src/OpenIDConnectClient.php
+++ b/src/OpenIDConnectClient.php
@@ -2030,6 +2030,11 @@ public function getLeeway(): int
         return $this->leeway;
     }
 
+    public function setLeeway(int $leeway)
+    {
+        $this->leeway = $leeway;
+    }
+
     /**
      * @return string
      */


Test patch:
diff --git a/tests/OpenIDConnectClientTest.php b/tests/OpenIDConnectClientTest.php
index dc2d7dee..27e47082 100644
--- a/tests/OpenIDConnectClientTest.php
+++ b/tests/OpenIDConnectClientTest.php
@@ -338,4 +338,15 @@ public function provideTestVerifyLogoutTokenClaimsData(): array
             ],
         ];
     }
+
+    public function testLeeway()
+    {
+        // Default leeway is 300
+        $client = new OpenIDConnectClient();
+        $this->assertEquals(300, $client->getLeeway());
+
+        // Set leeway to 100
+        $client->setLeeway(100);
+        $this->assertEquals(100, $client->getLeeway());
+    }
 }
Repository: codeigniter4/CodeIgniter4 (PHP)

Issue:
Bug: Fatal error when no user-agent is available
**Describe the bug**
If there is no user-agent available, an error will happen.

**CodeIgniter 4 version**
v4.0.3

**Affected module(s)**
HTTP\UserAgent


**Expected behavior, and steps to reproduce if appropriate**
1- Add a method to the Home controller
2- Put `var_dump((string)\Config\Services::request()->getUserAgent());` in the method you just created.
3- call that method from the command line(for instance)
4- I expect to see `string(0) ""` or `NULL` without seeing any exceptions

The actual result:
`PHP Fatal error:  Method CodeIgniter\HTTP\UserAgent::__toString() must not throw an exception, caught TypeError: Return value of CodeIgniter\HTTP\UserAgent::getAgentString() must be of the type string, null returned
`

**Context**
 - OS: Fedora 31
 - Web server -
 - PHP version 7.3.17



Discussion:

Patch:
diff --git a/system/HTTP/UserAgent.php b/system/HTTP/UserAgent.php
index c6873fd5b45b..4f7777ac75f6 100644
--- a/system/HTTP/UserAgent.php
+++ b/system/HTTP/UserAgent.php
@@ -51,7 +51,7 @@ class UserAgent
 	 *
 	 * @var string
 	 */
-	protected $agent;
+	protected $agent = '';
 
 	/**
 	 * Flag for if the user-agent belongs to a browser
@@ -130,14 +130,11 @@ class UserAgent
 	 *
 	 * Sets the User Agent and runs the compilation routine
 	 *
-	 * @param null $config
+	 * @param null|\Config\UserAgents $config
 	 */
-	public function __construct($config = null)
+	public function __construct(UserAgents $config = null)
 	{
-		if (is_null($config))
-		{
-			$this->config = new UserAgents();
-		}
+		$this->config = $config ?? new UserAgents();
 
 		if (isset($_SERVER['HTTP_USER_AGENT']))
 		{


Test patch:
diff --git a/tests/system/HTTP/UserAgentTest.php b/tests/system/HTTP/UserAgentTest.php
index d9f27b4191db..c4498fc8ab47 100644
--- a/tests/system/HTTP/UserAgentTest.php
+++ b/tests/system/HTTP/UserAgentTest.php
@@ -1,8 +1,11 @@
 <?php
+namespace CodeIgniter\HTTP;
 
 use CodeIgniter\HTTP\UserAgent;
+use CodeIgniter\Test\CIUnitTestCase;
 
-class UserAgent_test extends \CodeIgniter\Test\CIUnitTestCase {
+class UserAgentTest extends CIUnitTestCase
+{
 
 	protected $_user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27';
 	protected $_mobile_ua  = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7';
@@ -106,4 +109,10 @@ public function testParseBot()
 		$this->assertFalse($this->agent->isMobile());
 	}
 
+	public function testEmptyUserAgentVariable()
+	{
+		unset($_SERVER['HTTP_USER_AGENT']);
+		$agent = new UserAgent();
+		$this->assertEmpty((string) $agent);
+	}
 }
Repository: codeigniter4/CodeIgniter4 (PHP)

Issue:
/system/Images/Image.php image()->copy() mkdir
When I try to copy image to a directory that does not exist

`\Config\Services::image()->copy('..../non/exist/dir', 'image.jpg');`

copy() method couldn't create directories.

https://github.com/codeigniter4/CodeIgniter4/blob/f5545aa7274575c397efae4ebcf6c18779dcf895/system/Images/Image.php#L110-L113

Isn't it correct to do mkdir() with $targetPath?


Discussion:

Patch:
diff --git a/system/Images/Image.php b/system/Images/Image.php
index daec74388c4c..b3aab55a1b93 100644
--- a/system/Images/Image.php
+++ b/system/Images/Image.php
@@ -109,7 +109,7 @@ public function copy(string $targetPath, string $targetName = null, int $perms =
 
 		if (! is_dir($targetPath))
 		{
-			mkdir($targetName, 0755, true);
+			mkdir($targetPath, 0755, true);
 		}
 
 		if (! copy($this->getPathname(), "{$targetPath}{$targetName}"))


Test patch:
diff --git a/tests/system/Images/ImageTest.php b/tests/system/Images/ImageTest.php
index c9e0439ba756..838cac6fc03d 100644
--- a/tests/system/Images/ImageTest.php
+++ b/tests/system/Images/ImageTest.php
@@ -75,6 +75,13 @@ public function testCopyNewName()
 		$this->assertTrue($this->root->hasChild('new-logo.png'));
 	}
 
+	public function testCopyNewFolder()
+	{
+		$targetPath = $this->start . 'work/subfolder';
+		$this->image->copy($targetPath, 'new-logo.png');
+		$this->assertTrue($this->root->hasChild('work/subfolder/new-logo.png'));
+	}
+
 	public function testCopyNowhere()
 	{
 		$this->expectException(ImageException::class);
Repository: PHP-CS-Fixer/PHP-CS-Fixer (PHP)

Issue:
Bug in `static_lambda` rule
Hi,

It looks like the `static_lambda` rule is not working correctly in this case. Even if the case is totally unlikely to happen, it should not add the `static` keyword in the front.

```php
<?php

declare(strict_types=1);

namespace App;

class Foo
{
    public function foo()
    {
        return array_map(
            fn ($item) => $this,
            []
        );
    }
}
```

Current result:

```diff
--- /home/devlin/Code/XXX/src/Foo.php
+++ /home/devlin/Code/XXX/src/Foo.php
@@ -1,5 +1,12 @@
 <?php
 
 declare(strict_types=1);
 
 namespace App;
@@ -9,7 +16,7 @@
     public function foo()
     {
         return array_map(
-            fn ($item) => $this,
+            static fn ($item) => $this,
             []
         );
     }
```

Expected result:

It should not add the `static` keyword.


Discussion:
Hey, thanks for reporting!
would you like to also propose a PR fixing it? :)
Hi @keradus,

I just provided a one-liner fix and added a new test to prevent the situation in the future.



Patch:
diff --git a/src/Fixer/FunctionNotation/StaticLambdaFixer.php b/src/Fixer/FunctionNotation/StaticLambdaFixer.php
index 211f7c946a4..d844cfe8220 100644
--- a/src/Fixer/FunctionNotation/StaticLambdaFixer.php
+++ b/src/Fixer/FunctionNotation/StaticLambdaFixer.php
@@ -134,7 +134,7 @@ private function findExpressionEnd(Tokens $tokens, int $index): int
      */
     private function hasPossibleReferenceToThis(Tokens $tokens, int $startIndex, int $endIndex): bool
     {
-        for ($i = $startIndex; $i < $endIndex; ++$i) {
+        for ($i = $startIndex; $i <= $endIndex; ++$i) {
             if ($tokens[$i]->isGivenKind(T_VARIABLE) && '$this' === strtolower($tokens[$i]->getContent())) {
                 return true; // directly accessing '$this'
             }


Test patch:
diff --git a/tests/Fixer/FunctionNotation/StaticLambdaFixerTest.php b/tests/Fixer/FunctionNotation/StaticLambdaFixerTest.php
index bda80a6b38c..93dafb6a389 100644
--- a/tests/Fixer/FunctionNotation/StaticLambdaFixerTest.php
+++ b/tests/Fixer/FunctionNotation/StaticLambdaFixerTest.php
@@ -302,6 +302,20 @@ public function foo()
                     }
                 }',
             ],
+            [
+                '<?php
+                    class B
+                    {
+                        public function C()
+                        {
+                            return array_map(
+                                fn () => $this,
+                                []
+                            );
+                        }
+                    }
+                ',
+            ],
         ];
     }
 }
Repository: butschster/LaravelMetaTags (PHP)

Issue:
Ampersand in query string gets incorrectly escaped
**Describe the bug**
This seems to be same issue as #5 

**To Reproduce**

Write the following code

```php
Meta::setHrefLang('zh-Hans', 'https://example.com/?foo=bar&lang=zh-hans');
```

**Expected behavior**

It outputs
```html
<link rel="alternate" hreflang="zh-Hans" href="https://example.com/?foo=bar&amp;lang=zh-hans">
```

When it should output
```html
<link rel="alternate" hreflang="zh-Hans" href="https://example.com/?foo=bar&lang=zh-hans">
```

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
 - OS: [e.g. iOS]
 - Browser [e.g. chrome, safari]
 - Version [e.g. 22]

**Smartphone (please complete the following information):**
 - Device: [e.g. iPhone6]
 - OS: [e.g. iOS8.1]
 - Browser [e.g. stock browser, safari]
 - Version [e.g. 22]

**Additional context**
Currently I'm replacing all ampersands in my URLs with ESCAPED_AMPERSAND and then other way around after outputting the meta tags. It's not the best way to fix the issue but it works.



Discussion:

Patch:
diff --git a/src/MetaTags/Concerns/ManageLinksTags.php b/src/MetaTags/Concerns/ManageLinksTags.php
index 9d16edf..dc003d2 100644
--- a/src/MetaTags/Concerns/ManageLinksTags.php
+++ b/src/MetaTags/Concerns/ManageLinksTags.php
@@ -98,7 +98,7 @@ public function setHrefLang(string $lang, string $url)
         return $this->addLink('alternate_' . $lang, [
             'rel' => 'alternate',
             'hreflang' => $this->cleanString($lang),
-            'href' => $this->cleanString($url),
+            'href' => $url,
         ]);
     }
 
@@ -129,4 +129,4 @@ public function addLink(string $name, array $attributes)
 
         return $this->addTag($name, Tag::link($attributes));
     }
-}
\ No newline at end of file
+}


Test patch:
diff --git a/tests/MetaTags/HrefLangMetaTagsTest.php b/tests/MetaTags/HrefLangMetaTagsTest.php
index 10c0fa6..b892ed2 100644
--- a/tests/MetaTags/HrefLangMetaTagsTest.php
+++ b/tests/MetaTags/HrefLangMetaTagsTest.php
@@ -38,6 +38,17 @@ function test_hreflang_should_be_null_if_not_set()
         $this->assertNull($this->makeMetaTags()->getHrefLang('en'));
     }
 
+    function test_query_string()
+    {
+        $meta = $this->makeMetaTags()
+            ->setHrefLang('zh-hans', 'https://example.com/?foo=bar&lang=zh-hans');
+
+        $this->assertHtmlableEquals(
+            '<link rel="alternate" hreflang="zh-hans" href="https://example.com/?foo=bar&lang=zh-hans">',
+            $meta->getHrefLang('zh-hans')
+        );
+    }
+
     function test_convert_to_array()
     {
         $meta = $this->makeMetaTags()
Repository: Codeception/Codeception (PHP)

Issue:
`see` assertion fails when source code contains `<` in JS code
When asserting `$I->canSee('XYZ');` in an acceptance test using PhpBrowser the assertion returns `false` even though the page contains `XYZ`. 

The problem in my case was that my page contained code simillar to the following:

```html
<script>
    if (a <= b) {
        // ...
    }
</script>
<p>XYZ</p>
```

When the `getNormalizedResponseContent` gets called, [all HTML tags are removed with `strip_tags`](https://github.com/Codeception/Codeception/blob/758dd0d30fa7dd08b3eec6e444a162985b09c708/src/Codeception/Lib/InnerBrowser.php#L1880). `strip_tags` interprets the `<=` itself as a start tag and removes everything that follows the operator. Because of this problem the `XYZ` text cannot be found since it is removed from the response content.

I suggest removing the `script` tags manually before using `strip_tags`. For possible solutions see https://stackoverflow.com/a/22782081.



Discussion:
Interesting issue and looks like a nice solution. Could you prepare a patch and a test for this case?
Sure, see https://github.com/Codeception/Codeception/pull/4510



Patch:
diff --git a/src/Codeception/Lib/InnerBrowser.php b/src/Codeception/Lib/InnerBrowser.php
index ff3f335f68..4730de507f 100644
--- a/src/Codeception/Lib/InnerBrowser.php
+++ b/src/Codeception/Lib/InnerBrowser.php
@@ -1877,6 +1877,10 @@ protected function setCookiesFromOptions()
     protected function getNormalizedResponseContent()
     {
         $content = $this->_getResponseContent();
+        // Since strip_tags has problems with JS code that contains
+        // an <= operator the script tags have to be removed manually first.
+        $content = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $content);
+        
         $content = strip_tags($content);
         $content = html_entity_decode($content, ENT_QUOTES);
         $content = str_replace("\n", ' ', $content);


Test patch:
diff --git a/tests/data/app/view/info.php b/tests/data/app/view/info.php
index 5ab2e2e408..b8041eff0d 100755
--- a/tests/data/app/view/info.php
+++ b/tests/data/app/view/info.php
@@ -44,5 +44,14 @@
     <a id="third-link">Third</a>
 </div>
 
+<script>
+    var a = 2;
+    var b = 3;
+    if (a <= b) {
+        console.log('a is less than b!');
+    }
+</script>
+<p>Text behind JS comparision</p>
+
 </body>
 </html>
diff --git a/tests/unit/Codeception/Module/PhpBrowserTest.php b/tests/unit/Codeception/Module/PhpBrowserTest.php
index 304978704e..ac95361606 100644
--- a/tests/unit/Codeception/Module/PhpBrowserTest.php
+++ b/tests/unit/Codeception/Module/PhpBrowserTest.php
@@ -71,6 +71,14 @@ public function testLinksWithNonLatin()
         $this->module->click('Ссылочка');
     }
 
+    /**
+     * @see https://github.com/Codeception/Codeception/issues/4509
+     */
+    public function testSeeTextAfterJSComparisionOperator()
+    {
+        $this->module->amOnPage('/info');
+        $this->module->see('Text behind JS comparision');
+    }
 
     public function testSetMultipleCookies()
     {
Repository: PHP-CS-Fixer/PHP-CS-Fixer (PHP)

Issue:
`braces` fixer adds unnecessary empty lines in files where code doesn't start at offset 0
## Bug report

given a file where code doesn't start at offset 0 (which is bad, I know), cs-fixer recently started  (through the `braces` fixer) adding random empty lines to the file in front of each indented statement.

If I manually fix the indent, the problem disappears.

### Code snippet that reproduces the problem

```php
<?php

    function foo()
    {
    }
```

running cs-fixer with just the `braces` fixer enabled will produce the following diff

```diff
   1) /path/to/test.php (braces)
      ---------- begin diff ----------
--- /path/to/test.php
+++ /path/to/test.php
@@ -1,5 +1,6 @@
 <?php

+
     function foo()
     {
     }

      ----------- end diff -----------
```

if I remove the 4 space indent at the beginning of all lines, the empty line will not be added.

Also, I can't quite reproduce it yet, but sometimes after making unrelated changes to the file, *another* empty line will be added.


Discussion:
incidentally: is there a fixer that removes that unnecessary indentation?
@pilif This should be fixed by #6667.

> is there a fixer that removes that unnecessary indentation?

`braces` is about to be deprecated in favor of other new rules. This will be documented with #4885. In the meantime you can have a look at the [code of `BracesFixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/c1bcf0ce1abd610e8cbd0b309fa3f3085f799535/src/Fixer/Basic/BracesFixer.php#L218-L240) to find the new rules. `statement_indentation` should do what you want.



Patch:
diff --git a/src/Fixer/Whitespace/StatementIndentationFixer.php b/src/Fixer/Whitespace/StatementIndentationFixer.php
index 34ca8f984fd..94d7239ec1d 100644
--- a/src/Fixer/Whitespace/StatementIndentationFixer.php
+++ b/src/Fixer/Whitespace/StatementIndentationFixer.php
@@ -491,7 +491,7 @@ private function getLineIndentationWithBracesCompatibility(Tokens $tokens, int $
             && $tokens[$index + 1]->isWhitespace()
             && Preg::match('/\h+$/D', $tokens[$index + 1]->getContent())
         ) {
-            return Preg::replace('/.*?(\h+)$/D', '$1', $tokens[$index + 1]->getContent());
+            return Preg::replace('/.*?(\h+)$/sD', '$1', $tokens[$index + 1]->getContent());
         }
 
         return $regularIndent;


Test patch:
diff --git a/tests/Fixer/Basic/BracesFixerTest.php b/tests/Fixer/Basic/BracesFixerTest.php
index 57915fe2dbf..78488e2ee12 100644
--- a/tests/Fixer/Basic/BracesFixerTest.php
+++ b/tests/Fixer/Basic/BracesFixerTest.php
@@ -825,6 +825,13 @@ public function bar() {
     <?php
 }',
             ],
+            [
+                '<?php
+
+    function foo()
+    {
+    }',
+            ],
         ];
     }
Repository: codeigniter4/CodeIgniter4 (PHP)

Issue:
Bug: BaseService injectMock resetSingle case sensitivity
### PHP Version

7.4

### CodeIgniter4 Version

git

### CodeIgniter4 Installation Method

Git

### Which operating systems have you tested for this bug?

macOS, Linux

### Which server did you use?

fpm-fcgi

### Database

None

### What happened?

In Base Service injectMock will convert key to lowercase while resetSingle will try unset the key without converting to lowercase.

https://github.com/codeigniter4/CodeIgniter4/blob/833c67f10a35ad12843d66150af915a6beb5b1e8/system/Config/BaseService.php#L286-L302

### Steps to Reproduce

```
Services::injectMock('someService', $someObject);
Services::resetSingle('someService');
```

### Expected Output

Service should be reset but instead it is still kept due to key mismatch 

### Anything else?

_No response_


Discussion:

Patch:
diff --git a/system/Config/BaseService.php b/system/Config/BaseService.php
index 38bac37fdaa9..572b6cf576bd 100644
--- a/system/Config/BaseService.php
+++ b/system/Config/BaseService.php
@@ -288,6 +288,7 @@ public static function reset(bool $initAutoloader = false)
      */
     public static function resetSingle(string $name)
     {
+        $name = strtolower($name);
         unset(static::$mocks[$name], static::$instances[$name]);
     }
 


Test patch:
diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php
index 7fed04f53aa3..5f8cc476ae88 100644
--- a/tests/system/Config/ServicesTest.php
+++ b/tests/system/Config/ServicesTest.php
@@ -343,6 +343,17 @@ public function testResetSingle()
         $this->assertSame($security, $security2);
     }
 
+    public function testResetSingleCaseInsensitive()
+    {
+        Services::injectMock('response', new MockResponse(new App()));
+        $someService = service('response');
+        $this->assertInstanceOf(MockResponse::class, $someService);
+
+        Services::resetSingle('Response');
+        $someService = service('response');
+        $this->assertNotInstanceOf(MockResponse::class, $someService);
+    }
+
     public function testFilters()
     {
         $result = Services::filters();
Repository: PHP-CS-Fixer/PHP-CS-Fixer (PHP)

Issue:
First class callable issue
## Bug report

### Description

```
\array_filter([], \is_null(...));
```

will lead to an error as it's converted to:

```
\array_filter([], null === ...);
```

### Runtime version

PHP-CS-FIXER: `3.14.4`
PHP: `8.1.14`

### Used command

```
php-cs-fixer fix --ansi --diff --dry-run -vvv test.php
```

### Code snippet that reproduces the problem

```
\array_filter([], \is_null(...));
```



Discussion:

Patch:
diff --git a/src/Tokenizer/Analyzer/FunctionsAnalyzer.php b/src/Tokenizer/Analyzer/FunctionsAnalyzer.php
index 988b952fd35..b2cea1f7be8 100644
--- a/src/Tokenizer/Analyzer/FunctionsAnalyzer.php
+++ b/src/Tokenizer/Analyzer/FunctionsAnalyzer.php
@@ -65,14 +65,14 @@ public function isGlobalFunctionCall(Tokens $tokens, int $index): bool
             return false;
         }
 
-        if ($previousIsNamespaceSeparator) {
-            return true;
-        }
-
         if ($tokens[$tokens->getNextMeaningfulToken($nextIndex)]->isGivenKind(CT::T_FIRST_CLASS_CALLABLE)) {
             return false;
         }
 
+        if ($previousIsNamespaceSeparator) {
+            return true;
+        }
+
         if ($tokens->isChanged() || $tokens->getCodeHash() !== $this->functionsAnalysis['tokens']) {
             $this->buildFunctionsAnalysis($tokens);
         }


Test patch:
diff --git a/tests/Fixer/LanguageConstruct/IsNullFixerTest.php b/tests/Fixer/LanguageConstruct/IsNullFixerTest.php
index 1b1b81c7753..84edf94e9b9 100644
--- a/tests/Fixer/LanguageConstruct/IsNullFixerTest.php
+++ b/tests/Fixer/LanguageConstruct/IsNullFixerTest.php
@@ -243,4 +243,25 @@ public static function provideFixCases(): array
             ],
         ];
     }
+
+    /**
+     * @dataProvider provideFix81Cases
+     *
+     * @requires PHP 8.1
+     */
+    public function testFix81(string $expected, ?string $input = null): void
+    {
+        $this->doTest($expected, $input);
+    }
+
+    public static function provideFix81Cases(): iterable
+    {
+        yield 'first-class callable' => [
+            '<?php array_filter([], is_null(...));',
+        ];
+
+        yield 'first-class callable with leading slash' => [
+            '<?php array_filter([], \is_null(...));',
+        ];
+    }
 }
diff --git a/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php b/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php
index 728d65819c9..74b57a52649 100644
--- a/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php
+++ b/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php
@@ -342,6 +342,7 @@ public static function provideIsGlobalFunctionCallPhp81Cases(): iterable
             [],
             '<?php
 strlen(...);
+\strlen(...);
 $closure(...);
 $invokableObject(...);
 $obj->method(...);
Repository: codeigniter4/CodeIgniter4 (PHP)

Issue:
Bug: affctedRows - BadMethodCallException
**Describe the bug**
Calling the affectedRows method through a model instance may throw a BadMethodCallException if the value is zero.

```php
$model = new Model()
$model->set('key', 'value')
            ->where('id', 'nonExistentID')
            ->update();
$model->affectedRows(); // BadMethodCallException 
$model->db->affectedRows(); // 0
```

Since the result of executing the method is zero, and ``empty(0)`` === true, the code below throws an exception.

https://github.com/codeigniter4/CodeIgniter4/blob/4649204306276af6c06bfbd229fb1895fb5b0e4e/system/Model.php#L723-L728



Discussion:

Patch:
diff --git a/system/Model.php b/system/Model.php
index 580c691247f6..8b6b97c86345 100644
--- a/system/Model.php
+++ b/system/Model.php
@@ -710,24 +710,19 @@ public function __isset(string $name): bool
      * Provides direct access to method in the builder (if available)
      * and the database connection.
      *
-     * @return $this|null
+     * @return mixed
      */
     public function __call(string $name, array $params)
     {
-        $result = parent::__call($name, $params);
+        $builder = $this->builder();
+        $result  = null;
 
-        if ($result === null && method_exists($builder = $this->builder(), $name)) {
+        if (method_exists($this->db, $name)) {
+            $result = $this->db->{$name}(...$params);
+        } elseif (method_exists($builder, $name)) {
             $result = $builder->{$name}(...$params);
-        }
-
-        if (empty($result)) {
-            if (! method_exists($this->builder(), $name)) {
-                $className = static::class;
-
-                throw new BadMethodCallException('Call to undefined method ' . $className . '::' . $name);
-            }
-
-            return $result;
+        } else {
+            throw new BadMethodCallException('Call to undefined method ' . static::class . '::' . $name);
         }
 
         if ($result instanceof BaseBuilder) {


Test patch:
diff --git a/tests/system/Models/AffectedRowsTest.php b/tests/system/Models/AffectedRowsTest.php
new file mode 100644
index 000000000000..c15d84be341d
--- /dev/null
+++ b/tests/system/Models/AffectedRowsTest.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * This file is part of CodeIgniter 4 framework.
+ *
+ * (c) CodeIgniter Foundation <admin@codeigniter.com>
+ *
+ * For the full copyright and license information, please view
+ * the LICENSE file that was distributed with this source code.
+ */
+
+namespace CodeIgniter\Models;
+
+use Tests\Support\Models\UserModel;
+
+/**
+ * @internal
+ */
+final class AffectedRowsTest extends LiveModelTestCase
+{
+    /**
+     * @see https://github.com/codeigniter4/CodeIgniter4/issues/5137
+     */
+    public function testAffectedRowsWithEmptyUpdate(): void
+    {
+        $this->createModel(UserModel::class);
+        $notExistsId = -1;
+        $this->model
+            ->set('country', 'US')
+            ->where('id', $notExistsId)
+            ->update();
+
+        $this->assertSame(0, $this->model->affectedRows());
+    }
+}
Repository: Behat/Gherkin (PHP)

Issue:
Newlines in table content are not un-escaped
Per `datatables_with_new_lines.feature` in the gherkin testdata, with a table like:

```
    Given 3 lines of poetry on 5 lines
      |  \nraindrops--\nher last kiss\ngoodbye.\n  |
```

The `\n` characters should be parsed as actual newlines, to give cell content matching:

```
raindrops--
her last kiss
goodbye.

```

However, we currently return these as the raw content, e.g. with explicit `\` `n` characters, rather than newlines.

See #325


Discussion:

Patch:
diff --git a/src/GherkinCompatibilityMode.php b/src/GherkinCompatibilityMode.php
index 6ed5a339..c4a54978 100644
--- a/src/GherkinCompatibilityMode.php
+++ b/src/GherkinCompatibilityMode.php
@@ -32,6 +32,17 @@ public function shouldRemoveFeatureDescriptionPadding(): bool
         };
     }
 
+    /**
+     * @internal
+     */
+    public function shouldSupportNewlineEscapeSequenceInTableCell(): bool
+    {
+        return match ($this) {
+            self::LEGACY => false,
+            default => true,
+        };
+    }
+
     /**
      * @internal
      */
diff --git a/src/Lexer.php b/src/Lexer.php
index 73244f48..4d23f753 100644
--- a/src/Lexer.php
+++ b/src/Lexer.php
@@ -730,7 +730,11 @@ protected function scanTableRow()
         array_pop($rawColumns);
 
         $token = $this->takeToken('TableRow');
-        $columns = array_map(static fn ($column) => trim(str_replace(['\\|', '\\\\'], ['|', '\\'], $column)), $rawColumns);
+        if ($this->compatibilityMode->shouldSupportNewlineEscapeSequenceInTableCell()) {
+            $columns = array_map(static fn ($column) => trim(str_replace(['\\|', '\n', '\\\\'], ['|', "\n", '\\'], $column), ' '), $rawColumns);
+        } else {
+            $columns = array_map(static fn ($column) => trim(str_replace(['\\|', '\\\\'], ['|', '\\'], $column)), $rawColumns);
+        }
         $token['columns'] = $columns;
 
         $this->consumeLine();


Test patch:
diff --git a/tests/Cucumber/CompatibilityTest.php b/tests/Cucumber/CompatibilityTest.php
index c181944b..febeb0b4 100644
--- a/tests/Cucumber/CompatibilityTest.php
+++ b/tests/Cucumber/CompatibilityTest.php
@@ -59,7 +59,6 @@ class CompatibilityTest extends TestCase
         'gherkin-32' => [
             'complex_background.feature' => 'Rule keyword not supported',
             'docstrings.feature' => 'Escaped delimiters in docstrings are not unescaped',
-            'datatables_with_new_lines.feature' => 'Escaped newlines in table cells are not unescaped',
             'escaped_pipes.feature' => 'Escaped newlines in table cells are not unescaped',
             'rule.feature' => 'Rule keyword not supported',
             'rule_with_tag.feature' => 'Rule keyword not supported',
Repository: pybamm-team/PyBaMM (Python)

Issue:
Domains as strings
**Describe the bug**
The `Domain` class checks that `domain` is an iterable and raises a `TypeError` if it isn't.
However, a `str` domain is not caught by this as `iter("a string") == True`.
This isn't caught by the test in `TestIndependentVariable`; test should be
```python
with self.assertRaises(TypeError):
   pybamm.IndependentVariable("a", domain="test")
```

**Suggested fix**
If `domain` is a string, replace with `list(domain)`.




Discussion:

Patch:
diff --git a/pybamm/expression_tree/domain.py b/pybamm/expression_tree/domain.py
index 5ca645b25d..75be730fb3 100644
--- a/pybamm/expression_tree/domain.py
+++ b/pybamm/expression_tree/domain.py
@@ -13,17 +13,19 @@ class Domain(object):
 
     name: str
         the name of the node
-    domain : iterable of str
+    domain : iterable of str, or str
         the list of domains
 
     """
 
     def __init__(self, name, domain=[]):
         super().__init__(name)
+        if isinstance(domain, str):
+            domain = [domain]
         try:
             iter(domain)
         except TypeError:
-            raise TypeError('Domain: argument domain is not iterable')
+            raise TypeError("Domain: argument domain is not iterable")
         else:
             self.domain = domain
 


Test patch:
diff --git a/tests/test_expression_tree/test_independent_variable.py b/tests/test_expression_tree/test_independent_variable.py
index 7ce7b560cc..22db0db95f 100644
--- a/tests/test_expression_tree/test_independent_variable.py
+++ b/tests/test_expression_tree/test_independent_variable.py
@@ -13,9 +13,12 @@ def test_variable_init(self):
         a = pybamm.IndependentVariable("a")
         self.assertEqual(a.name, "a")
         self.assertEqual(a.domain, [])
-        a = pybamm.IndependentVariable("a", domain=['test'])
-        self.assertEqual(a.domain[0], 'test')
-        self.assertRaises(TypeError, pybamm.IndependentVariable("a", domain='test'))
+        a = pybamm.IndependentVariable("a", domain=["test"])
+        self.assertEqual(a.domain[0], "test")
+        a = pybamm.IndependentVariable("a", domain="test")
+        self.assertEqual(a.domain[0], "test")
+        with self.assertRaises(TypeError):
+            pybamm.IndependentVariable("a", domain=1)
 
 
 if __name__ == "__main__":
Repository: aws/chalice (Python)

Issue:
package.py creates AWS::Serverless::Function Environment Variables property incorrectly
`AWS::Serverless::Function` implements environment variables as

```
{ "Properties": {
  "Environment": {
    "Variables": { ... } } }
```

(see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-environment.html)

However, `package.py` is defining the structure as:

```
{"Properties: {
  "EnvironmentVariables": {
    "Variables": { ... } } }
```


Discussion:
Thanks for reporting it. I'll get this fixed.



Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 5da92d9b8..9ffebb7b2 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -2,6 +2,13 @@
 CHANGELOG
 =========
 
+Next Release (TBD)
+==================
+
+* Fix package command not correctly setting environment variables
+  (`#795 <https://github.com/aws/chalice/issues/795>`__)
+
+
 1.2.1
 =====
 
diff --git a/chalice/package.py b/chalice/package.py
index 284bc426e..0292b9a1e 100644
--- a/chalice/package.py
+++ b/chalice/package.py
@@ -114,7 +114,7 @@ def _generate_lambdafunction(self, resource, template):
             },
         }
         if resource.environment_variables:
-            resources[cfn_name]['Properties']['EnvironmentVariables'] = {
+            resources[cfn_name]['Properties']['Environment'] = {
                 'Variables': resource.environment_variables
             }
         self._add_iam_role(resource, resources[cfn_name])


Test patch:
diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py
index 9f7d21364..2bb4e336a 100644
--- a/tests/unit/test_package.py
+++ b/tests/unit/test_package.py
@@ -152,7 +152,7 @@ def test_adds_env_vars_when_provided(self, sample_app):
         function.environment_variables = {'foo': 'bar'}
         template = self.template_gen.generate_sam_template([function])
         cfn_resource = list(template['Resources'].values())[0]
-        assert cfn_resource['Properties']['EnvironmentVariables'] == {
+        assert cfn_resource['Properties']['Environment'] == {
             'Variables': {
                 'foo': 'bar'
             }
Repository: python-attrs/attrs (Python)

Issue:
Couldn't use numpy arrays as defaults on attrs 19.2
The following code stops working when upgrading from attrs 19.1 to 19.2:

```
@attr.s(auto_attribs=True)
class NumParams:
    N = 3
    alpha = np.zeros((N, Ng))
```

Seems that change #556 requires that default attributes should implement `__eq__`, which is not the case for numpy arrays.

Taceback is:
```
    @attr.s(auto_attribs=True)
../../../../miniconda/envs/attests/lib/python3.6/site-packages/attr/_make.py:1010: in wrap
    return builder.build_class()
../../../../miniconda/envs/attests/lib/python3.6/site-packages/attr/_make.py:498: in build_class
    return self._patch_original_class()
../../../../miniconda/envs/attests/lib/python3.6/site-packages/attr/_make.py:512: in _patch_original_class
    and getattr(cls, name, _sentinel) != _sentinel
E   ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
```


Discussion:
the issue can be resolved by switching the sentinel check from equality to is
Yep, opening a PR right away
FYI 19.3.0 with that fix is on PyPI. Sorry for the regression and thanks to @RonnyPfannschmidt and @nicoddemus for the quick fix while I was sound asleep! :)



Patch:
diff --git a/changelog.d/585.change.rst b/changelog.d/585.change.rst
new file mode 100644
index 000000000..1b31403ba
--- /dev/null
+++ b/changelog.d/585.change.rst
@@ -0,0 +1,1 @@
+Fixed ``auto_attribs`` usage when default values cannot be compared directly with ``==``, such as ``numpy`` arrays.
diff --git a/src/attr/_make.py b/src/attr/_make.py
index 0ddca6ad2..46f9c54ec 100644
--- a/src/attr/_make.py
+++ b/src/attr/_make.py
@@ -509,7 +509,7 @@ def _patch_original_class(self):
             for name in self._attr_names:
                 if (
                     name not in base_names
-                    and getattr(cls, name, _sentinel) != _sentinel
+                    and getattr(cls, name, _sentinel) is not _sentinel
                 ):
                     try:
                         delattr(cls, name)


Test patch:
diff --git a/tests/test_annotations.py b/tests/test_annotations.py
index 1f23f1d45..43b4d0f5c 100644
--- a/tests/test_annotations.py
+++ b/tests/test_annotations.py
@@ -282,3 +282,18 @@ class C:
 
         with pytest.raises(AttributeError):
             C.y
+
+    def test_non_comparable_defaults(self):
+        """
+        Regression test for #585: objects that are not directly comparable
+        (for example numpy arrays) would cause a crash when used as
+        default values of an attrs auto-attrib class.
+        """
+
+        class NonComparable:
+            def __eq__(self, other):
+                raise ValueError
+
+        @attr.s(auto_attribs=True)
+        class C:
+            x: typing.Any = NonComparable()
Repository: prometheus/client_python (Python)

Issue:
Pushgateway exposition: properly handle empty label values in grouping key
See https://github.com/prometheus/pushgateway/pull/346 for a documentation update for the PGW about empty label values in the grouping key. (Note: It's really just documenting the current state of the PGW. No change of behavior of the PGW involved.)

The code in `exposition.py` currently accepts empty label values for the grouping key. However, it then attempts to push in an invalid way, see  https://github.com/prometheus/pushgateway/issues/344 for details (the issue demonstrates it with client_golang, but presumably client_python would show exactly the same behavior).

While the use case for empty label values in the grouping key is somewhat esoteric, a case can be made for it. Thus, we should probably support it in the way now [documented](https://github.com/prometheus/pushgateway/pull/346). Alternative is to disallow it in `exposition.py`. Just the current state of pretending it works but then fail to push is clearly a bug.


Discussion:

Patch:
diff --git a/prometheus_client/exposition.py b/prometheus_client/exposition.py
index 634066f7..191e7454 100644
--- a/prometheus_client/exposition.py
+++ b/prometheus_client/exposition.py
@@ -362,7 +362,10 @@ def _use_gateway(method, gateway, job, registry, grouping_key, timeout, handler)
 
 
 def _escape_grouping_key(k, v):
-    if '/' in v:
+    if v == "" :
+        # Per https://github.com/prometheus/pushgateway/pull/346.
+        return k + "@base64", "="
+    elif '/' in v:
         # Added in Pushgateway 0.9.0.
         return k + "@base64", base64.urlsafe_b64encode(v.encode("utf-8")).decode("utf-8")
     else:


Test patch:
diff --git a/tests/test_exposition.py b/tests/test_exposition.py
index 47c200f3..ac731980 100644
--- a/tests/test_exposition.py
+++ b/tests/test_exposition.py
@@ -249,6 +249,13 @@ def test_push_with_groupingkey(self):
         self.assertEqual(self.requests[0][0].headers.get('content-type'), CONTENT_TYPE_LATEST)
         self.assertEqual(self.requests[0][1], b'# HELP g help\n# TYPE g gauge\ng 0.0\n')
 
+    def test_push_with_groupingkey_empty_label(self):
+        push_to_gateway(self.address, "my_job", self.registry, {'a': ''})
+        self.assertEqual(self.requests[0][0].command, 'PUT')
+        self.assertEqual(self.requests[0][0].path, '/metrics/job/my_job/a@base64/=')
+        self.assertEqual(self.requests[0][0].headers.get('content-type'), CONTENT_TYPE_LATEST)
+        self.assertEqual(self.requests[0][1], b'# HELP g help\n# TYPE g gauge\ng 0.0\n')
+
     def test_push_with_complex_groupingkey(self):
         push_to_gateway(self.address, "my_job", self.registry, {'a': 9, 'b': 'a/ z'})
         self.assertEqual(self.requests[0][0].command, 'PUT')
Repository: biopython/biopython (Python)

Issue:
Information in the SeqFeature repr is hidden
The current behavior of repr hides its `qualifiers` attribute, even if it is non-empty. It would be helpful in some situations to surface the qualifiers attribute in the repr as discussed in https://github.com/biopython/biopython/issues/3576.

A proposal for such a behaviour has been made by @peterjc in https://github.com/biopython/biopython/pull/3578.


Discussion:
Applied, thank you.
My pleasure.



Patch:
diff --git a/Bio/SeqFeature.py b/Bio/SeqFeature.py
index 625154ac370..3e6abfe3cb3 100644
--- a/Bio/SeqFeature.py
+++ b/Bio/SeqFeature.py
@@ -279,6 +279,8 @@ def __repr__(self):
             answer += ", location_operator=%r" % self.location_operator
         if self.id and self.id != "<unknown id>":
             answer += ", id=%r" % self.id
+        if self.qualifiers:
+            answer += ", qualifiers=..."
         if self.ref:
             answer += ", ref=%r" % self.ref
         if self.ref_db:


Test patch:
diff --git a/Tests/test_Uniprot.py b/Tests/test_Uniprot.py
index 3b2278604c7..e594202f861 100644
--- a/Tests/test_Uniprot.py
+++ b/Tests/test_Uniprot.py
@@ -45,7 +45,7 @@ def test_uni001(self):
         self.assertEqual(len(seq_record.features), 1)
         self.assertEqual(
             repr(seq_record.features[0]),
-            "SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(116)), type='chain', id='PRO_0000377969')",
+            "SeqFeature(FeatureLocation(ExactPosition(0), ExactPosition(116)), type='chain', id='PRO_0000377969', qualifiers=...)",
         )
 
         self.assertEqual(
@@ -434,7 +434,7 @@ def test_uni003(self):
 
         self.assertEqual(
             repr(seq_record.features[1]),
-            "SeqFeature(FeatureLocation(ExactPosition(17), ExactPosition(43)), type='propeptide', id='PRO_0000009556')",
+            "SeqFeature(FeatureLocation(ExactPosition(17), ExactPosition(43)), type='propeptide', id='PRO_0000009556', qualifiers=...)",
         )
 
         self.assertEqual(