Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:07:14+00:00 2026-05-29T12:07:14+00:00

PHP Fatal error: Default value for parameters with a class type hint can only

  • 0
PHP Fatal error:  Default value for parameters with a class type hint can only be NULL in /usr/share/php/PHPUnit/Framework/Test.php on line 66
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:130
PHP   4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/php/PHPUnit/TextUI/Command.php:150
PHP   5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/php/PHPUnit/Runner/BaseTestRunner.php:104
PHP   6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/php/PHPUnit/Runner/BaseTestRunner.php:168
PHP   7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/Runner/StandardTestSuiteLoader.php:78
PHP   8. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:79
PHP   9. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:95
PHP  10. phpunit_autoload() /usr/share/php/PHPUnit/Autoload.php:0
PHP  11. require() /usr/share/php/PHPUnit/Autoload.php:203
PHP  12. phpunit_autoload() /usr/share/php/PHPUnit/Autoload.php:0

The line in question has:

public function run(PHPUnit_Framework_TestResult $result = NULL)

When I remove the = NULL it goes through but fails on another line that also has an = NULL, the screwed up thing is that the error basically says it HAS to be NULL, which it IS.

I have not modified PhpUnit in any way, I installed it using the method described here:

http://www.giocc.com/installing-phpunit-on-ubuntu-11-04-natty-narwhal.html

I honestly don’t understand why this is happening.. something tells me PHP is bugged in that it’s giving me the wrong error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T12:07:17+00:00Added an answer on May 29, 2026 at 12:07 pm

    Found the answer, quoting myself from the comments section:

    Oh damn I found the problem, and it’s a silly one on my side. I had a constant file that was defining NULL for use in an ORM library. It’s defined in it’s own namespace so it shouldn’t have interfered with the global constant, but I guess constants are a bit tricky with namespaces..

    So TIL, if you want to define constants in a namespace, simply adding namespace to the top of the file won’t suffice, you have to define the constants like so

    define('NAMESPACE\CONSTANT',        'value');
    // or
    define(__NAMESPACE__ . '\CONSTANT', 'value'); // to use the current namespace
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class absclass { abstract public function fuc(); } reports: PHP Fatal error: Class absclass
With include('basemodel.php'); I get Fatal error: Class 'BaseModel' not found in C:\xampp\htdocs\allsides\account\model.php on line
I'm getting Fatal error: Class 'Form_Login' not found in /route/to/project/application/controllers/AuthController.php on line XX when
Do you know any solution to recover from the PHP fatal error : Allowed
Possible Duplicate: PHP ToString() equivalent I get this error: Catchable fatal error: Object of
I'm having trouble with this PHP script where I get the error Fatal error
http://php.net/manual/en/mysqli.init.php $ConnectionResource = mysqli::init(); The above code fails with: Fatal error: Non-static method mysqli::init()
Talk about falling at the first hurdle. My test script: <?php require_once('PHPUnit/Framework.php'); class TransferResponseTest
I have an abstract class. I'm extending that class. I'm getting this error: Fatal
Why can't I use code like this? <?php class NoConstructor { } class ChildWithConstructor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.