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

Review all uses of htmlspecialchars and zen_db_output #270

Closed
drbyte opened this issue Jan 10, 2015 · 4 comments
Closed

Review all uses of htmlspecialchars and zen_db_output #270

drbyte opened this issue Jan 10, 2015 · 4 comments
Assignees
Milestone

Comments

@drbyte
Copy link
Member

drbyte commented Jan 10, 2015

I'm pretty sure that all remaining references to zen_db_output() should actually be using zen_output_string_protected() for consistency.

... and maybe then temporarily move zen_db_output() to the compatibility functions file and redefine it to be a call to zen_output_string_protected(), for retirement in a future version.

Further, I think a review of all direct calls to htmlspecialchars() should be done to replace them with zen_output_string_protected() also ... unless there's a specific reason not to.

Credits to @lat9 http://www.zen-cart.com/showthread.php?215798

@drbyte drbyte added this to the v1.6.0 milestone Jan 10, 2015
@drbyte drbyte added the [Status] up-for-grabs / PR welcome A PR is welcome to be submitted for consideration label Sep 30, 2015
mc12345678 pushed a commit to mc12345678/zc-v1-series that referenced this issue Feb 15, 2016
…issue zencart#270 and begin substituting foreach for while loops.
mc12345678 pushed a commit to mc12345678/zc-v1-series that referenced this issue Feb 15, 2016
zen_output_string_protected($1) Issue zencart#270.

No review done for htmlspecialchars that do not force protected
mode by setting the fourth parameter to true.  All other htmlspecialchars
usage has not been reviewed.
@mc12345678
Copy link
Contributor

Why does admin: zen_output_string_protected use htmlspecials($string, ENT_COMPAT, CHARSET, FALSE) and catalog side instead use htmlspecials($string, ENT_COMPAT, CHARSET, TRUE) (last factor being to only single encode on the admin and double encode on the store side?) Is this part of what has to be modified/corrected in order to simplify across the two systems? A majority of admin calls directly to htmlspecials seem to use TRUE like on the catalog side, but then calls to zen_output_string_protected on the admin side are not automatically "double-encoded".

@lat9
Copy link
Contributor

lat9 commented Feb 16, 2016

I dunno, but you can follow the "rules" that I documented here to make sure that you don't get double-encoding where you don't want it.

FWIW, I've stopped using the zen_output_string_protected function because of the discontinuity between the store-front and admin-console operation.

@mc12345678
Copy link
Contributor

I was thinking of that or similar as I was going through it and trying to see what "consistent use" existed for both sides as to why one is one way and the other not and what it would take to align the two... (Afterall it would be great if all/most functions were one type/style right? Rather than multiple examples of code that accomplishes the "same thing"?) Seems like the way to go would be the catalog side as that has been the more important side to address, so the question becomes what would it take on the admin side actually to not use the currently defined zen_output_string_protected and instead have it work like the catalog side?

Of course thought this was going to be easier to fix/address than it turned into, but now just trying to see if there is a way to map it forward to use one or the other.

mc12345678 pushed a commit to mc12345678/zc-v1-series that referenced this issue Feb 17, 2016
…issue zencart#270 and begin substituting foreach for while loops.
mc12345678 pushed a commit to mc12345678/zc-v1-series that referenced this issue Feb 17, 2016
zen_output_string_protected($1) Issue zencart#270.

No review done for htmlspecialchars that do not force protected
mode by setting the fourth parameter to true.  All other htmlspecialchars
usage has not been reviewed.
mc12345678 pushed a commit to mc12345678/zc-v1-series that referenced this issue Feb 17, 2016
…ation

of encoding (clearly use the default setting), this will help in future
modifications to address issue zencart#270 to streamline the use of
htmlspecialchars.
mc12345678 pushed a commit to mc12345678/zc-v1-series that referenced this issue Feb 17, 2016
mc12345678 pushed a commit to mc12345678/zc-v1-series that referenced this issue Feb 21, 2016
Expanding the data for zen_db_output uses on the admin side in preparation
to 1) remove all usage of zen_db_output, 2) redefine zen_output_string_protected
so that it functions on the admin side the same as on the store side.
Requires substituting function into an equivalent standard function.
mc12345678 pushed a commit to mc12345678/zc-v1-series that referenced this issue Feb 22, 2016
@scottcwilson
Copy link
Sponsor Contributor

It seems like the only files left that still do zen_db_output are:

admin/reviews.php
admin/packingslip.php
admin/orders.php
admin/invoice.php
includes/classes/order.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants