Valid php4 code throws 'invalid index' in php5

FATAL ERROR; ‘invalid index’ thrown by working php4 code when run with php5.

Web searchs turned up 3 possible corrections (none worked):

  1. use error_reporting(E_ALL & ~E_NOTICE | ~E_DEPRECATED);
  2. initialize offending array;
  3. offending array is not an array – be sure to declare it.

Tests:

  • defined array: $buffer = array(); Checked with is_array($buffer), which says it is an array.
  • opened source file: $fh = fopen($_SERVER{‘DOCUMENT_ROOT’}. /…/…/kvpisow2.txt file
  • loaded $buffer $buffer = fgets($fh).
  • tested result using is_array($buffer)? NO! it is not an array.
  • treated $buffer as if an array and tried to set each $value = null (for initialization)
  • then did echo var_dump($buffer) and got original source displayed as the originally desired array (but without any ‘null’ values.

Any suggestions on what to try next will be appreciated – worked too long on this one!

Thanks for any ideas
usit

Use square brackets instead of curly braces.