Non-abstract method Foo::bar() must contain body

by Josh Highland on December 1, 2011

I was working on one of my PHP based projects, and I was getting the following error:

Non-abstract method Foo::bar() must contain body in Foo.php on line 10

The problem was that I had accidentally put a semicolon at the end of the first line of the function:

WRONG WAY:

class Foo 
{ 
    function bar(); // extra semicolon! 
    { 
        // stuff 
    } 
}

RIGHT WAY:

class Foo 
{ 
    function bar()    // no semicolon, yay 
    { 
        // stuff 
    } 
}
  • digg Non abstract method Foo::bar() must contain body
  • facebook Non abstract method Foo::bar() must contain body
  • stumbleupon Non abstract method Foo::bar() must contain body
  • twitter Non abstract method Foo::bar() must contain body
  • delicious Non abstract method Foo::bar() must contain body
  • reddit Non abstract method Foo::bar() must contain body
  • friendfeed Non abstract method Foo::bar() must contain body
  • posterous Non abstract method Foo::bar() must contain body
  • tumblr Non abstract method Foo::bar() must contain body

Leave a Comment

Previous post:

Next post: