diff --git a/src/poetry/packages/locker.py b/src/poetry/packages/locker.py
index 71290689da4..5a71f8a40c1 100644
--- a/src/poetry/packages/locker.py
+++ b/src/poetry/packages/locker.py
@@ -410,12 +410,7 @@ def _dump_package(self, package: Package) -> dict[str, Any]:
         if package.extras:
             extras = {}
             for name, deps in sorted(package.extras.items()):
-                # TODO: This should use dep.to_pep_508() once this is fixed
-                # https://github.com/python-poetry/poetry-core/pull/102
-                extras[name] = sorted(
-                    dep.base_pep_508_name if not dep.constraint.is_any() else dep.name
-                    for dep in deps
-                )
+                extras[name] = sorted(dep.base_pep_508_name for dep in deps)
 
             data["extras"] = extras
 
diff --git a/tests/installation/fixtures/update-with-locked-extras.test b/tests/installation/fixtures/update-with-locked-extras.test
index 4872311c702..3609212e222 100644
--- a/tests/installation/fixtures/update-with-locked-extras.test
+++ b/tests/installation/fixtures/update-with-locked-extras.test
@@ -11,7 +11,7 @@ python-versions = "*"
 "C" = {version = "^1.0", markers = "python_version >= \"2.7\" and python_version < \"2.8\""}
 
 [package.extras]
-foo = ["b"]
+foo = ["B"]
 
 [[package]]
 name = "B"
diff --git a/tests/installation/fixtures/with-pypi-repository.test b/tests/installation/fixtures/with-pypi-repository.test
index ac57e43ec7b..1bde9b82750 100644
--- a/tests/installation/fixtures/with-pypi-repository.test
+++ b/tests/installation/fixtures/with-pypi-repository.test
@@ -7,9 +7,9 @@ optional = false
 python-versions = "*"
 
 [package.extras]
-dev = ["coverage", "hypothesis", "pympler", "pytest", "six", "sphinx", "zope-interface", "zope-interface"]
-docs = ["sphinx", "zope-interface"]
-tests = ["coverage", "hypothesis", "pympler", "pytest", "six", "zope-interface"]
+dev = ["coverage", "hypothesis", "pympler", "pytest", "six", "sphinx", "zope.interface", "zope.interface"]
+docs = ["sphinx", "zope.interface"]
+tests = ["coverage", "hypothesis", "pympler", "pytest", "six", "zope.interface"]
 
 [[package]]
 name = "colorama"