File tree Expand file tree Collapse file tree
modules/saml/src/Auth/Process
modules/saml/src/Auth/Process Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class FilterScopes extends ProcessingFilter
3434 */
3535 private bool $ allowNonScoped = true ;
3636
37+
3738 /**
3839 * Constructor for the processing filter.
3940 *
Original file line number Diff line number Diff line change 3838 */
3939class Configuration implements Utils \ClearableState
4040{
41- /**
42- * The release version of this package
43- */
44- public const string VERSION = 'dev-master ' ;
45-
4641 /**
4742 * A default value which means that the given option is required.
4843 */
@@ -384,7 +379,14 @@ public static function getInstance(string $instancename = 'simplesaml'): Configu
384379 */
385380 public function getVersion (): string
386381 {
387- return self ::VERSION ;
382+ $ version = \Composer \InstalledVersions::getRootPackage ()['pretty_version ' ];
383+ // If the returned version is in format `vX.Y.Z`, remove leading
384+ // `v` to keep the compatibility with the previously used
385+ // format `X.Y.Z`.
386+ if (preg_match ('/^v\d+\.\d+\.\d+/ ' , $ version )) {
387+ return substr ($ version , 1 );
388+ }
389+ return $ version ;
388390 }
389391
390392
Original file line number Diff line number Diff line change @@ -223,10 +223,11 @@ public function testAttributeValueMultipleAt(): void
223223 $ this ->assertEquals ($ request ['Attributes ' ], $ result ['Attributes ' ]);
224224 }
225225
226+
226227 /**
227228 * Test that non-scoped values pass or not depending on default or filter config setting.
228229 */
229- public function testNonScopedValuesRemovedWhenDisallowed (): void
230+ public function testNonScopedValuesRemovedWhenDisallowed (): void
230231 {
231232 $ config = [
232233 // Explicitly disallow non-scoped values
Original file line number Diff line number Diff line change @@ -24,7 +24,11 @@ class ConfigurationTest extends ClearStateTestCase
2424 public function testGetVersion (): void
2525 {
2626 $ c = Configuration::getOptionalConfig ();
27- $ this ->assertEquals ($ c ->getVersion (), Configuration::VERSION );
27+ $ version = \Composer \InstalledVersions::getRootPackage ()['pretty_version ' ];
28+ if (preg_match ('/^v\d+\.\d+\.\d+/ ' , $ version )) {
29+ $ version = substr ($ version , 1 );
30+ }
31+ $ this ->assertEquals ($ c ->getVersion (), $ version );
2832 }
2933
3034
You can’t perform that action at this time.
0 commit comments