PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » PHP » PHP_Parser » Bug #5115

Visibility modifiers in method declaration throws parse error

Details

Submitted2005-08-16 23:46 UTC
Fromluis at m3 dot net
Assignedcellog
StatusClosed
PackagePHP_Parser
PHP Version5.0.4
OSFedora Core 2
Roadmaps(Not assigned)

Comments

[2005-08-16 23:46 UTC] luis at m3 dot net

Description:
------------
Parsing a method declaration containing visibility modifiers, such as public/private/protected, causes the parser to throw an error.

Test script:
---------------
<?php

class myClass {

private function _myMethod() {
}
}

?>

Actual result:
--------------
object(PEAR_Error)
'error_message_prefix' => ''
'mode' => 1
'level' => 1024
'code' => null
'message' => 'Error at line 5, Unexpected T_FUNCTION, syntax error'
'userinfo' => null
'backtrace' =>
array
0 =>
array
'file' => '/home/luis/myProjects/workspace/coolFramework/lib/pear/PEAR.php'
'line' => 542
'function' => 'PEAR_Error'
'class' => 'PEAR_Error'
'type' => '->'
'args' =>
array
0 => 'Error at line 5, Unexpected T_FUNCTION, syntax error'
1 => null
2 => 1
3 => 1024
4 => null
1 =>
array
'file' => '/home/luis/myProjects/workspace/coolFramework/lib/pear/PHP/Parser/Core.php'
'line' => 357
'function' => 'raiseError'
'class' => 'PHP_Parser_Core'
'type' => '->'
'args' =>
array
0 => 'Error at line 5, Unexpected T_FUNCTION, syntax error'
2 =>
array
'file' => '/home/luis/myProjects/workspace/coolFramework/lib/pear/PHP/Parser/Core.php'
'line' => 518
'function' => 'raiseError'
'class' => 'PHP_Parser_Core'
'type' => '->'
'args' =>
array
0 => 'Error at line 5, Unexpected T_FUNCTION, syntax error'
1 =>
array
0 => 'end-of-file'
1 => 'T_STATIC'
2 => 'T_ABSTRACT'
3 => 'T_FINAL'
4 => 'T_PRIVATE'
5 => 'T_PROTECTED'
6 => 'T_PUBLIC'