Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We changed the reference of Services class. #582

Merged
merged 1 commit into from
Jul 3, 2017

Conversation

ytetsuro
Copy link
Contributor

@ytetsuro ytetsuro commented Jul 2, 2017

I tried to overwrite Router with application/Config/Services.php, but CodeIgniter.php refers to CodeIgniter\Config\Servces.
Therefore, I made this PR.

sample: application/Config/Services.php

class Services extends CoreServices
{

	public static function router(\CodeIgniter\Router\RouteCollectionInterface $routes = null, $getShared = true)
	{
		if ($getShared)
		{
			return self::getSharedInstance('router', $routes);
		}

		if (empty($routes))
		{
			$routes = self::routes(true);
		}

		return new \App\Core\Router\Router($routes);
	}
}

@lonnieezell
Copy link
Member

Looks good. Thanks1

@lonnieezell lonnieezell merged commit d191986 into codeigniter4:develop Jul 3, 2017
@ytetsuro
Copy link
Contributor Author

ytetsuro commented Jul 4, 2017

Merged thanks!!

@daylightstudio
Copy link
Contributor

I'm currently getting an error with a fresh download that I think is caused by this merge. The error is:

Fatal error: Cannot use Config\Services as Services because the name is already in use in .../system/CodeIgniter.php on line 38

@lonnieezell
Copy link
Member

@daylightstudio Weird, I'm not seeing that. Did a git clone, went to the folder and ran php serve.php and fired up the browser to localhost:8080 and it all worked as expected on the welcome page.

@daylightstudio
Copy link
Contributor

daylightstudio commented Jul 10, 2017

OK. Let me have some other folks at work test it out to see if they can replicate. I wasn't seeing anyone else complaining about the issue either so let me dig into it further and I'll report back what I'm able to find out. What version of PHP 7 are you running just for comparison even though it seems highly unlikely that's the issue? I was testing it on a basic MAMP installation with PHP 7.0.10.

@lonnieezell
Copy link
Member

That was tested under a MAMP 7.0.15 release.

@daylightstudio
Copy link
Contributor

FYI, I upgraded to the latest version of MAMP that has the 7.0.15 version and the problem went away. Not sure if it was a PHP/MAMP version or something else, but my issue has been resolved.

@lonnieezell
Copy link
Member

Good to know! Very strange issue, though.

@davidgv88
Copy link
Contributor

In WAMP I use PHP 7.0.10 and i get the same message:

Fatal error: Cannot use Config\Services as Services because the name is already in use in C:\wamp64\www\CodeIgniter4\system\CodeIgniter.php on line 38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants