php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73139 php throws error on OK function call
Submitted: 2016-09-21 21:19 UTC Modified: 2016-09-21 23:04 UTC
From: jim dot michaels at Jesusnjim dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 7.1.0RC2 OS: vista 32 amd
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jim dot michaels at Jesusnjim dot com
New email:
PHP Version: OS:

 

 [2016-09-21 21:19 UTC] jim dot michaels at Jesusnjim dot com
Description:
------------
parser throwing errors on a function call when it should not.

this should not be happening. code is fine to my knowledge.
Wed 09/21/2016 14:17:02.80|C:\w\Jesusnjim|>php --version
PHP 7.1.0-dev (cli) (built: Sep  5 2016 07:44:38) ( NTS MSVC14 (Visual C++ 2015) x86 )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies


Test script:
---------------
<?php
function ReplaceComment($haystack, $replacemiddlewith, $beginneedle, $endneedle, &$result, $tag){return true;}

$result="";
$z=ReplaceComment("<!-- menustart --><!-- menuend -->", "filler", '<!-- menustart -->','<!-- menuend -->',  $result,"visitor");
echo ($z?"false":"true").$result."\r\n";

$z=ReplaceComment("<!-- menustart -->t<!-- menuend -->", "filler2, '<!-- menustart -->','<!-- menuend -->', $result,"visitor");
echo ($z?"false":"true").$result."\r\n";

$z=ReplaceComment("<!-- menustart -->123456789012345678<!-- menuend -->", "filler3, '<!-- menustart -->','<!-- menuend -->',$result,"visitor");
echo ($z?"false":"true").$result."\r\n";
exit(1);
?>

Expected result:
----------------
Wed 09/21/2016 14:13:10.19|C:\w\Jesusnjim|>php menu7a.php
PHP Parse error:  syntax error, unexpected 'visitor' (T_STRING), expecting ',' or ')' in C:\w\Jesusnjim\menu7a.php on line 196

Parse error: syntax error, unexpected 'visitor' (T_STRING), expecting ',' or ')' in C:\w\Jesusnjim\menu7a.php on line 196

Wed 09/21/2016 14:13:59.24|C:\w\Jesusnjim|>

Actual result:
--------------
Wed 09/21/2016 14:13:10.19|C:\w\Jesusnjim|>php menu7a.php
PHP Parse error:  syntax error, unexpected 'visitor' (T_STRING), expecting ',' or ')' in C:\w\Jesusnjim\menu7a.php on line 196

Parse error: syntax error, unexpected 'visitor' (T_STRING), expecting ',' or ')' in C:\w\Jesusnjim\menu7a.php on line 196

Wed 09/21/2016 14:13:59.24|C:\w\Jesusnjim|>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-21 23:04 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2016-09-21 23:04 UTC] requinix@php.net
"filler2,

"filler3,
 [2016-09-22 07:44 UTC] jim dot michaels at Jesusnjim dot com
ReplaceComment is now functioning. I missed the quote. but the function that calls it to replace multiple content tagged items in a file does not work.
menu7a.php in http://Jesusnjim.com/z/menu7a.zip
does not handle switch statements correctly.
to use, you must copy config7a-example.php to config7a.php and edit config7a.php with your web site setup. it is almost done, but I think there is a bug in my code and in php because funny things are happening and things that should happen don't, like replacing file content.
I have to go to bed right now, pick up in the morning I hope.
 [2016-09-22 07:54 UTC] jim dot michaels at Jesusnjim dot com
tomorrow morn I will be going on a photo shoot.
copy index.html index2.html
put in menu7a.php line 191 for test (this function is near end of file):
ReplaceFileContent(1,"/index2.html","HOME","VISITOR");
exit(1);


php menu7a.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC