Comments (10)
Thanks. I'll take a look at it when I have time. That may be a couple months from now though, so feel free to send a PR if you have time.
from super_closure.
Okay
from super_closure.
We can just do the same as what class preloader has done?
from super_closure.
Wait, our code already does this. How come this is nor working for you. That code never gets called on 2.x?
from super_closure.
Our code looks like this:
/**
* @param \ReflectionFunction $reflection
*
* @throws ClosureAnalysisException
*
* @return \PhpParser\Node[]
*/
private function getFileAst(\ReflectionFunction $reflection)
{
$fileName = $reflection->getFileName();
if (!file_exists($fileName)) {
throw new ClosureAnalysisException(
"The file containing the closure, \"{$fileName}\" did not exist."
);
}
return $this->getParser()->parse(file_get_contents($fileName));
}
/**
* @return CodeParser
*/
private function getParser()
{
if (class_exists('PhpParser\ParserFactory')) {
return (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
}
return new CodeParser(new EmulativeLexer);
}
The bottom line is only ever called on php parser 1.x.
from super_closure.
Are you noticing this issue due to a static analzyer, or due to it actually happening?
from super_closure.
I was experiencing the issue with nikic/php-parser v2.1.0 and jeremeamia/SuperClosure 2.2.0 on my production server but not on my development server (which is weird). For a quick fix in my production server, I had to use v1.4.1 of php parser. Out of curiosity, I tested SuperClosure 2.2.0 and php-parser v2.1.0 on another project on thesame production server and wasn't getting the exception. When I open your code in PhpStorm, I notice that the bottom line is underlined with
the error "Cannot Instantiate Interface Parser" thesame exception that was displayed when I was using nikic/php-parser v2.1.0 and jeremeamia/SuperClosure 2.2.0 on the prod server.
from super_closure.
DId you restart/reload php-fpm after deploying?
from super_closure.
It looks like you just have stale caches on the productyion server.
from super_closure.
Let me reload and see what I get.
from super_closure.
Related Issues (20)
- Nested closures not working. HOT 1
- Why do serialization errors not throw? HOT 4
- Superclosure is now removed from Laravel HOT 1
- wrong repo issue ;)
- Will this still work in Laravel 5.7 HOT 1
- Arrow functions serialization HOT 8
- erialization of closure failed: The closure was not found within the abstract syntax tree.' HOT 2
- Release 2.2.0 HOT 12
- self:: usage throws error when unserializing HOT 10
- Failing on HHVM HOT 6
- Namespace issue HOT 3
- "Serialize" to javascript? HOT 1
- Error when using Zend Guard HOT 6
- Note HOT 3
- Bug with EventEmitter? HOT 4
- PHP5: Cannot bind an instance to a static closure HOT 1
- Serialization of 'Closure' is not allowed HOT 4
- runing composer update on php 7 gives errors with Closure Analyser HOT 1
- Gitter chat link HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from super_closure.