Ticket #522 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

jSelectorInterface not compatible with jSelectorFactory

Reported by: doubleface Owned by: doubleface
Priority: normal Milestone: Jelix 1.0.3
Component: jelix:core Version: 1.0.2
Severity: minor Keywords:
Cc: Php version:
Review: review+ Hosting Provider:
Blocked By: Documentation needed: no
Blocking:

Description

The following code does not work :

    $s = new jSelectorInterface('test');
    $long_selector = $s->toString(true);
    $s2 = jSelectorFactory::create($long_selector);

Because here, $long_selector equals "iface:modulename~test" and then jSelectorFactory tries to create a jSelectoriface instead of a jSelectorInterface.

I see 2 solutions :

  • Rename jSelectorInterface to jSelectorIface but this may cause a problem to those who already use jSelectorInterface directly (without jClass::incIface), maybe not many people after all.
  • Change regexp of jSelectorFactory from "/^([a-z]{3,5})\:([\w~\/\.]+)$/" to "/^([a-z]{3,9})\:([\w~\/\.]+)$/" and change jSelectorInterface::type to "interface"

But maybe I don't see all impacts of such modifications... Your choice.

Attachments

jSelectorInterface.patch (1.7 kB) - added by doubleface 2 years ago.

Change History

Changed 2 years ago by laurentj

  • component changed from jelix to jelix:core
  • milestone set to Jelix 1.1

Oups, I think I made a mistake :-)

The best solution I think is to change the class name to jSelectorIface, and to recreate jSelectorInterface which just inherits from jSelectorIface, and to mark it as @deprecated. Then this class will be removed in 1.2 or later.

Changed 2 years ago by doubleface

  • review set to review?

Here is the corresponding patch

Changed 2 years ago by doubleface

Changed 2 years ago by doubleface

  • owner changed from laurentj to doubleface
  • status changed from new to assigned

Changed 2 years ago by laurentj

  • review changed from review? to review+
  • milestone changed from Jelix 1.1 to Jelix 1.0.3

It's ok. Just replace "@since 1.0b2" by "@since 1.0.3" in the comment of jSelectorIface ;-)

You can land this patch into the 1.0.x branch and the trunk.

Thanks for this patch.

Changed 2 years ago by doubleface

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.