php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16298 Arrays being called in a function() call produces unexpected error.
Submitted: 2002-03-26 21:10 UTC Modified: 2002-03-27 06:32 UTC
From: m4a1_damien at hotmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.1.2 OS: WinXP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: m4a1_damien at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-03-26 21:10 UTC] m4a1_damien at hotmail dot com
When making a simple function...

<?php
function include_page ($script_prefs[templated_file]) {
  $script_prefs["templated_file_extension"] = substr ($script_prefs["templated_file"], strrpos ($script_prefs["templated_file"], ".") +1);

  if (($script_prefs["templated_file_extension"] != "php") || (eregi ("^[_a-z0-9-]+$", $script_prefs["templated_file"])) || (file_exists ("C:\\Apache\\htdocs\\templates\\" . $script_prefs["templated_file"]))) {
    include_once ("C:\\Apache\\htdocs\\templates\\" . $script_prefs["templated_file"]);
  } else {
    include_once ("C:\\Apache\\htdocs\\templates\\error.php");
  }

  return;
}
?>

(Small scale beta templating system)

When you call the function include_page function with a normal variable...

i.e. "function include_page($variable)" the function works find...


...but...

If you use it with a variable...

i.e. "function include_page($script_pref["variable"])" the webpage produces the following...

Parse error: parse error, expecting `')'' in c:\apache\htdocs\index.php on line 2

I have rewritten the function name sveral times, and in diffrent forms.. with 's and without.. but no change.. only when you use a variable inside a array...

My PHP.ini has full error reporting, a debugging mode switched on (startup errors etc on)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-27 06:32 UTC] sander@php.net
This is just not possible, and I don't see any need for it. Just use function foo($bar) {}.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 20:01:35 2024 UTC