Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scottcwilson committed Aug 16, 2020
1 parent f479057 commit e51016b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 33 deletions.
2 changes: 1 addition & 1 deletion content/user/miscellaneous/age_check.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: How can I limit the age of my customers to people over 18?
description: In Zen Cart, how can I limit the age of my customers to people over 18?
description: Selling age-restricted products
category: miscellaneous
weight: 10
---
Expand Down
4 changes: 2 additions & 2 deletions content/user/miscellaneous/can_zen_cart.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Can Zen Cart do this? Miscellaneous FAQs
description: Can Zen Cart do this? Miscellaneous FAQs about Zen Cart
title: Can Zen Cart do this?
description: Miscellaneous FAQs about Zen Cart
category: miscellaneous
weight: -1
---
Expand Down
2 changes: 1 addition & 1 deletion content/user/miscellaneous/configure.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: configure.php explained
description: Zen Cart configure.php explained
description: Understanding the main Zen Cart configuration file
category: miscellaneous
weight: 1
---
Expand Down
4 changes: 2 additions & 2 deletions content/user/miscellaneous/force_www.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: How can I force my site to add "www." before the URL if visitors don't enter it?
description: URL rewrite to add www subdomain Zen Cart
title: How can I force my site to add "www." to the URL?
description: URL rewrite to add www subdomain for Zen Cart
category: miscellaneous
weight: 10
---
Expand Down
2 changes: 1 addition & 1 deletion content/user/miscellaneous/missing_close_php.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Some of my PHP files are missing the ?> at the end of the file
description: In Zen Cart, some of my PHP files are missing the ?> at the end of the file
description: Is a missing PHP closing tag an error?
category: miscellaneous
weight: 10
---
Expand Down
2 changes: 1 addition & 1 deletion content/user/miscellaneous/salemaker_vs_specials.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Salemaker vs Specials
description: Zen Cart Salemaker vs Specials
description: Reducing prices on categories and single products
category: miscellaneous
weight: 10
---
Expand Down
36 changes: 11 additions & 25 deletions content/user/upgrading/php_warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,21 @@ function __construct()
PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /Users/sp/Developer/zc157/includes/functions/extra_functions/sfl_functions.php on line 160.
```

Change
The direction for PHP 7.2+ is to refactor `each` to `foreach` as follows:

```
while (list($products_id, ) = each($contents)) {
```
1. `foreach()` doesn't need a `reset()` to be called before it runs, so those can be removed.

to
```
foreach(array_keys($contents) as $products_id) {
```
2. There are 3 syntax formats, depending on how the parameters are presented in the `list()` call:

It would also be valid to use
```
foreach($contents as $products_id => $data) {
```
a) `while(list($key, $value) = each($foo))`
This becomes `foreach($foo as $key => $value)`

although some IDEs would complain about `$data` being an unused variable.
b) `while(list(, $value) = each($foo))`
This becomes `foreach($foo as $value)`

c) `while(list($key, ) = each($foo))`
This becomes `foreach($foo as $key => $value)`

If the code looks more like

```
while(list($key, $value) = each($array))
```

change to

```
foreach($array as $key => $value)
```

There are several levels of PHP problems, with the least serious being _notices_ and _warnings_. More serious are PHP _errors_, which can cause a blank screen or partially blank screen. Several common PHP errors are discussed in [this article](/user/troubleshooting/php_debug_logs).
There are several levels of PHP problems, with the least serious being _notices_ and _warnings_.
More serious are PHP _errors_, which can cause a blank screen or partially blank screen. Several common PHP errors are discussed in [this article](/user/troubleshooting/php_debug_logs).

0 comments on commit e51016b

Please sign in to comment.