Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mvc: Phalcon framework dependency #6389

Closed
2 tasks done
fichtner opened this issue Mar 3, 2023 · 0 comments · Fixed by #7455
Closed
2 tasks done

mvc: Phalcon framework dependency #6389

fichtner opened this issue Mar 3, 2023 · 0 comments · Fixed by #7455
Assignees
Labels
cleanup Low impact changes roadmap Major roadmap item
Milestone

Comments

@fichtner
Copy link
Member

fichtner commented Mar 3, 2023

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

Given the state of Phalcon, it’s probably a good idea to start planning for losing more dependencies on the framework.

Describe the solution you like

A good start would probably be to start with our model implementation, which seems to depend on the following classes for which we should build native php alternatives in that case:

  • Phalcon\Filter\Validation\Validator\Email
  • Phalcon\Filter\Validation\Validator\ExclusionIn
  • Phalcon\Filter\Validation\Validator\InclusionIn
  • Phalcon\Filter\Validation\Validator\Numericality
  • Phalcon\Filter\Validation\Validator\PresenceOf
  • Phalcon\Filter\Validation\Validator\Regex
  • Phalcon\Filter\Validation\Validator\Url
  • OPNsense\Phalcon\Logger\Logger
  • Phalcon\Filter\Validation\Exception
  • Phalcon\Di\FactoryDefault
  • Phalcon\Logger\Adapter\Syslog
  • Phalcon\Messages\Message
  • Phalcon\Messages\Messages
  • Phalcon\Config\Config

Describe alternatives you considered

N/A

Additional context

N/A

@fichtner fichtner added the cleanup Low impact changes label Mar 3, 2023
@fichtner fichtner added this to the 23.7 milestone Mar 3, 2023
@fichtner fichtner modified the milestones: 23.7, 24.1 Jun 29, 2023
@fichtner fichtner modified the milestones: 24.1, 24.7 Jan 11, 2024
AdSchellevis added a commit that referenced this issue Feb 13, 2024
Add simple Message class and remove "Messages" dependancy in Validation.php, which should be backwards compatible with all existing validations.
By moving  \Phalcon\Filter\Validation() into validate() we're making the validation paths more explicit, if an objects implements ValidatorInterface, it uses phalcon, otherwise it's a simple BaseValidator passing messages back to $this->appendMessage().

The original phalcon Message class has additional fields we don't use, we only use fieldname for tracking purposes and the message itself.
AdSchellevis added a commit that referenced this issue Feb 13, 2024
fix regression in c2ea9aa and amend unit tests.
swhite2 added a commit that referenced this issue Feb 14, 2024
Properties should be copied 1-to-1 before we apply the required
defaults if necessary. In the previous situation this caused
required properties to be set to an empty value after the default
value had already been written to it. In the failure case we
attempt to be a bit more explicit and refer to the crash reporter.

While here, the master branch has dropped the Phalcon Messages class,
so switch to count() since this seems to inherit array type
and is therefore backwards compatible:

$msgs = new \Phalcon\Messages\Messages();
$count = count($msgs);
// $count == 0

See #6389
fichtner pushed a commit that referenced this issue Feb 15, 2024
Properties should be copied 1-to-1 before we apply the required
defaults if necessary. In the previous situation this caused
required properties to be set to an empty value after the default
value had already been written to it. In the failure case we
attempt to be a bit more explicit and refer to the crash reporter.

While here, the master branch has dropped the Phalcon Messages class,
so switch to count() since this seems to inherit array type
and is therefore backwards compatible:

$msgs = new \Phalcon\Messages\Messages();
$count = count($msgs);
// $count == 0

See #6389

(cherry picked from commit fdc8a8f)
(cherry picked from commit 3cb2f3d)
AdSchellevis added a commit that referenced this issue Feb 15, 2024
…for backwards compatible OPNsense\Base\Messages\Message class. for #6389
AdSchellevis added a commit that referenced this issue Feb 18, 2024
Fix regression in c2ea9aa, performValidation() should return an object which is able to add new messages (using appendMessage()) as the previous Messages class did.
fichtner pushed a commit that referenced this issue Mar 12, 2024
Add simple Message class and remove "Messages" dependancy in Validation.php, which should be backwards compatible with all existing validations.
By moving  \Phalcon\Filter\Validation() into validate() we're making the validation paths more explicit, if an objects implements ValidatorInterface, it uses phalcon, otherwise it's a simple BaseValidator passing messages back to $this->appendMessage().

The original phalcon Message class has additional fields we don't use, we only use fieldname for tracking purposes and the message itself.
fichtner pushed a commit that referenced this issue Mar 12, 2024
fix regression in c2ea9aa and amend unit tests.
fichtner pushed a commit that referenced this issue Mar 12, 2024
Properties should be copied 1-to-1 before we apply the required
defaults if necessary. In the previous situation this caused
required properties to be set to an empty value after the default
value had already been written to it. In the failure case we
attempt to be a bit more explicit and refer to the crash reporter.

While here, the master branch has dropped the Phalcon Messages class,
so switch to count() since this seems to inherit array type
and is therefore backwards compatible:

$msgs = new \Phalcon\Messages\Messages();
$count = count($msgs);
// $count == 0

See #6389
fichtner pushed a commit that referenced this issue Mar 12, 2024
…for backwards compatible OPNsense\Base\Messages\Message class. for #6389
fichtner pushed a commit that referenced this issue Mar 12, 2024
Fix regression in c2ea9aa, performValidation() should return an object which is able to add new messages (using appendMessage()) as the previous Messages class did.
AdSchellevis added a commit that referenced this issue Apr 30, 2024
…e to offer multiple model paths in the phalcon configuration, in practice this was never used (all models live in /usr/local/opnsense/mvc/app/models).

for #6389
AdSchellevis added a commit that referenced this issue Apr 30, 2024
…e to offer multiple model paths in the phalcon configuration, in practice this was never used (all models live in /usr/local/opnsense/mvc/app/models).

for #6389
AdSchellevis added a commit that referenced this issue Apr 30, 2024
fichtner pushed a commit that referenced this issue May 6, 2024
…e\ValidationException (both simple empty Exception classes).

for #6389

(cherry picked from commit 0dc6089)
AdSchellevis added a commit that referenced this issue May 7, 2024
The original intend was to be able to reuse the Csrf class, but as this requires direct access to the session object, it's likely not a good idea for the goals of #6389
Since the legacy pages need a lock on session anyway,  keeping it doesn't make a difference.
AdSchellevis added a commit that referenced this issue May 12, 2024
…sses with a routing class of our own. (#6389)

This removes most phalcon code currently being used on our end, except the Volt templates (which are re-wrapped) and a translation class we can easisly replace later in a separate commit. Consumers of our controller classes shouldn't notice a difference as the used objects and methods are named the same.

The most notable changes are the following ones:

* Exceptions about not being able to find a requested path now break down into different exceptions inheriting from DispatchException, which makes it easier from the entrypoint (api.php, index.php) to catch and handle accordingly.
* When not in development mode, raw exceptions are not being returned anymore, which increases security
* The Dispatcher class is reponsible for object construction and mapping validation (valid uri, but no object found)
* The Router class replaces previous Application class, it disects offered uri's into namespaces, classnames and methods to call.
AdSchellevis added a commit that referenced this issue May 12, 2024
This removes most phalcon code currently being used on our end, except the Volt templates (which are re-wrapped) and a translation class we can easily replace later in a separate commit.
Consumers of our controller classes shouldn't notice a difference as the used objects and methods are named the same.

The most notable changes are the following ones:

* Exceptions about not being able to find a requested path now break down into different exceptions inheriting from DispatchException, which makes it easier from the entrypoint (api.php, index.php) to catch and handle accordingly.
* When not in development mode, raw exceptions are not being returned anymore, which increases security
* The Dispatcher class is reponsible for object construction and mapping validation (valid uri, but no object found)
* The Router class replaces previous Application class, it disects offered uri's into namespaces, classnames and methods to call.

In the long run there should be a seperate controller for controllers using volt templates or api calls, but as the existing ones don't distinct between this and the output handling is different now, we can park this for a later moment in time (the performance penalty should be rather low).

Some unused functionality has been removed, for example support for the  X-HTTP-Method-Override header in Request->getMethod() (see https://github.com/phalcon/cphalcon/blob/44243c07658d060cd8a21761743b0f4fc01641aa/phalcon/Http/Request.zep#L599-L609).
AdSchellevis added a commit that referenced this issue May 12, 2024
This removes most phalcon code currently being used on our end, except the Volt templates (which are re-wrapped) and a translation class we can easily replace later in a separate commit.
Consumers of our controller classes shouldn't notice a difference as the used objects and methods are named the same.

The most notable changes are the following ones:

* Exceptions about not being able to find a requested path now break down into different exceptions inheriting from DispatchException, which makes it easier from the entrypoint (api.php, index.php) to catch and handle accordingly.
* When not in development mode, raw exceptions are not being returned anymore, which increases security
* The Dispatcher class is reponsible for object construction and mapping validation (valid uri, but no object found)
* The Router class replaces previous Application class, it disects offered uri's into namespaces, classnames and methods to call.

In the long run there should be a seperate controller for controllers using volt templates or api calls, but as the existing ones don't distinct between this and the output handling is different now, we can park this for a later moment in time (the performance penalty should be rather low).

Some unused functionality has been removed, for example support for the  X-HTTP-Method-Override header in Request->getMethod() (see https://github.com/phalcon/cphalcon/blob/44243c07658d060cd8a21761743b0f4fc01641aa/phalcon/Http/Request.zep#L599-L609).
AdSchellevis added a commit that referenced this issue May 13, 2024
This removes most phalcon code currently being used on our end, except the Volt templates (which are re-wrapped) and a translation class we can easily replace later in a separate commit.
Consumers of our controller classes shouldn't notice a difference as the used objects and methods are named the same.

The most notable changes are the following ones:

* Exceptions about not being able to find a requested path now break down into different exceptions inheriting from DispatchException, which makes it easier from the entrypoint (api.php, index.php) to catch and handle accordingly.
* When not in development mode, raw exceptions are not being returned anymore, which increases security
* The Dispatcher class is reponsible for object construction and mapping validation (valid uri, but no object found)
* The Router class replaces previous Application class, it disects offered uri's into namespaces, classnames and methods to call.

In the long run there should be a seperate controller for controllers using volt templates or api calls, but as the existing ones don't distinct between this and the output handling is different now, we can park this for a later moment in time (the performance penalty should be rather low).

Some unused functionality has been removed, for example support for the  X-HTTP-Method-Override header in Request->getMethod() (see https://github.com/phalcon/cphalcon/blob/44243c07658d060cd8a21761743b0f4fc01641aa/phalcon/Http/Request.zep#L599-L609).
@fichtner fichtner linked a pull request May 13, 2024 that will close this issue
AdSchellevis added a commit that referenced this issue May 13, 2024
This removes most phalcon code currently being used on our end, except the Volt templates (which are re-wrapped) and a translation class we can easily replace later in a separate commit.
Consumers of our controller classes shouldn't notice a difference as the used objects and methods are named the same.

The most notable changes are the following ones:

* Exceptions about not being able to find a requested path now break down into different exceptions inheriting from DispatchException, which makes it easier from the entrypoint (api.php, index.php) to catch and handle accordingly.
* When not in development mode, raw exceptions are not being returned anymore, which increases security
* The Dispatcher class is reponsible for object construction and mapping validation (valid uri, but no object found)
* The Router class replaces previous Application class, it disects offered uri's into namespaces, classnames and methods to call.

In the long run there should be a seperate controller for controllers using volt templates or api calls, but as the existing ones don't distinct between this and the output handling is different now, we can park this for a later moment in time (the performance penalty should be rather low).

Some unused functionality has been removed, for example support for the  X-HTTP-Method-Override header in Request->getMethod() (see https://github.com/phalcon/cphalcon/blob/44243c07658d060cd8a21761743b0f4fc01641aa/phalcon/Http/Request.zep#L599-L609).
fichtner pushed a commit that referenced this issue May 13, 2024
This removes most phalcon code currently being used on our end, except the Volt templates (which are re-wrapped) and a translation class we can easily replace later in a separate commit.
Consumers of our controller classes shouldn't notice a difference as the used objects and methods are named the same.

The most notable changes are the following ones:

* Exceptions about not being able to find a requested path now break down into different exceptions inheriting from DispatchException, which makes it easier from the entrypoint (api.php, index.php) to catch and handle accordingly.
* When not in development mode, raw exceptions are not being returned anymore, which increases security
* The Dispatcher class is reponsible for object construction and mapping validation (valid uri, but no object found)
* The Router class replaces previous Application class, it disects offered uri's into namespaces, classnames and methods to call.

In the long run there should be a seperate controller for controllers using volt templates or api calls, but as the existing ones don't distinct between this and the output handling is different now, we can park this for a later moment in time (the performance penalty should be rather low).

Some unused functionality has been removed, for example support for the  X-HTTP-Method-Override header in Request->getMethod() (see https://github.com/phalcon/cphalcon/blob/44243c07658d060cd8a21761743b0f4fc01641aa/phalcon/Http/Request.zep#L599-L609).
AdSchellevis added a commit that referenced this issue May 21, 2024
…uments returned $_POST previsouly. (same likely the case for get())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Low impact changes roadmap Major roadmap item
Development

Successfully merging a pull request may close this issue.

3 participants