Eclipse - stack overflow errors - php

Since some time I'm having problems with Eclipse. When opening any file with a class which extends one specified class (Presenter), an error occurs:
Multiple problems have occurred http://img64.imageshack.us/img64/9678/screeneclipseproblems.png
Internal Error http://img202.imageshack.us/img202/5131/screeneclipseproblemspr.png
I've noted, that problems occurs only when loading the mentioned class - Presenter.
When I delete "extends Presenter" or when I delete the file, which contains class Presenter, the problems dissappear.
Class Presenter is part of the PHP framework Nette, so you can see the contents of this class here:
http://api.nette.org/1.0/__filesource/fsource_Nette-Application__ApplicationPresenter.php.html
I can provide contents of LOG files, if that may help, but those are large (over 1 MiB).

I faced the same problem. Here is the way to fixe it:
First goto [workbench_directory]/.metadata/.plugins/ - remove the folder named "eclipse.org.core.resources" and keep a copy of it.
Now go to the eclipse directory using CommandPrompt(Windows) or Terminal(in linux,mac)
write the command $ eclipse -clean ---> this will start your eclipse application.
Now close the eclipse application and restore the "eclipse.org.core.resources" folder that you removed in the First step.
That's it! You won't see the problem.

What exact version of Eclipse and PDT are you using?
There was a bug last month about that kind of error: bug 316876, but it appears to be fixed in PDT-2.2.0.v20100616.
Check also your eclipse.ini like, for instance, this ones (depending on your eclipse version).

You can increase VM stacksize and check. But a better solution would be to work out how to avoid recursing so much.
Add the flag -Xss1024k in the VM arguments for starting Eclipse (in eclipse.ini file in your Eclipse installation folder).
You can also increase the stack size in MB, by using -Xss1m for example.

I'm running Eclipse Indigo. I've adding the following to my eclipse.ini file as I didn't have them in there.
-Xmx1024m
-Xss1m
I haven't been able to salvage my Eclipse installation. The Error logs in Eclipse pertain to issues with the OSGI and Team plugin. I can try uninstalling these.

Related

PHPSpreadsheet - How Do I Use Auto Migration Tool

I'm a long time reader, but new to asking questions. Please correct me if I have somehow asked incorrectly.
Intro
We are upgrading our servers from PHP 5.4 to PHP 7.2 and one of the libraries that is not fully compatible with the new version of PHP is PHPExcel. So, we are upgrading to PHPSpreadsheet as well. A lot of our projects use PHPExcel in different ways, so if I can get the Auto Migrate tool to work, it would be a huge time save for me even if it misses some things.
The instructions to use the tool are found here:
https://phpspreadsheet.readthedocs.io/en/develop/topics/migration-from-PHPExcel/
And they simply say to use the following command after installing via Composer (which I've done):
cd /project/to/migrate/src
/project/to/migrate/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel
Problem
I am able to execute the migrator fine, but it only scans files inside the "vendor/phpoffice/phpspreadsheet" directory. It does not scan any files inside my project at all.
How do I get the migration script to scan my projects files, and not it's own files?
Local Environment
Windows 10
Latest XAMPP
PHP 7.2.11
How I Am Running It
cd C:\path\to\project\that\uses\phpexcel
php vendor\phpoffice\phpspreadsheet\bin\migrate-from-phpexcel
How I have Tried To Solve So Far
Running the exact command on the instructions page (ends up running two commands, second one is an invalid command)
Moving "migrate-from-phpexcel" to my project root and running it there
Editing "migrate-from-phpexcel" after moving to project root and pointing to the Bootstrap.php file (Runs, but only inside the library itself. Same problem)
I don't know how, or from where, you ran the 2nd command but that command traversed my whole project and made what looks like appropriate conversions. I ran it from project root while I was IN my IDE (PhpStorm, using its 'Run Command' tool). I ran the same command you did, like this:
php vendor\phpoffice\phpspreadsheet\bin\migrate-from-phpexcel
After confirming "yes", I saw it traverse the directory, changing various files but skipping its OWN files.
When I tested my script, I encountered a warning about 'a non-numeric value' from one of its modules (Coordinate.php on line 312 & line 313). I did some research on the warning but couldn't find anything to address it except people blaming PHP 7.1** (I'm running 7.2.*). So I suppressed the warning and my spreadsheet was created exactly as I specified.
Here is my first statement in my 'create excel' script:
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
The only other "manual" change I had to make was changing the file format of the 'createWriter' from 'Excel2007' to 'Xlsx' -- exactly as it states in the docs. A more complicated spreadsheet may require more manual work, but probably not as much as someone above indicated.
In case it helps someone else: while updating a legacy project that was using PhpExcel v1.8.2, running rector on the codebase failed on most of the files that needed to be processed, with the error:
[ERROR] Could not process "test.php" file, due to:
"Analyze error: "PHPExcel_Writer_Exception (Unable to load PDF Rendering library) thrown while looking
for class PHPExcel_Writer_PDF_DomPDF.". Include your files in "$parameters->set(Option::AUTOLOAD_PATHS,
[...]);" in "rector.php" config.
See https://github.com/rectorphp/rector#configuration".
To get around this, I followed suggestions here: https://github.com/rectorphp/rector/issues/6418#issuecomment-882923495 and commented out lines in the PhpExcel install itself - the lines containing throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library'); in files DomPDF.php, mPDF.php, tcPDF.php in Classes/PHPExcel/Writer/PDF/
2022+ Automated Upgrade Approach
Discalimer: I wrote a tool that handles automated migration from CLI called Rector, so people don't have to upgrade PHP code manually anymore. It's free, open-source, on GitHub.
The offical migration tool only fixes class names. There are 24 more cases, that needs to be changed, lLike mentioned "'Excel2007' to 'Xlsx'".
We needed to upgrade huge PHP project and manual changes would take too much time and could stuck us for weeks. Instead, we made an upgrade set with all 25 cases, that changed code for us:
In 4 steps ↓
1. Install Rector to your PHP project
composer require rector/rector-phpoffice --dev
2. Create rector.php config
vendor/bin/rector init
3. Add the spreadsheet set:
use Rector\PHPOffice\Set\PHPOfficeSetList;
use Rector\Config\RectorConfig;
return static function (RectorConfig $rectorConfig) {
$rectorConfig->sets([PHPOfficeSetList::PHPEXCEL_TO_PHPSPREADSHEET]);
};
4. Run Rector on your code
# to see diff with no changes
vendor/bin/rector process src --dry-run
# to make changes happen
vendor/bin/rector process src
If you want to read more, we wrote a short post about it

Configuring php-cs-fixer and PATH variable

A while ago, I successfully configured Atom to beautify my PHP using php-cs-fixer, but now I need to go through the same process on another Mac and can't remember exactly how I did it.
As a front-end dev, I'm not a PHP expert, but I understand that the Atom plugin is merely the middleman facilitating the actual fixing using php-cs-fixer, which, by default, it doesn't have access to. Once I installed the fixer, I had to add its location to my PATH variable. The confusing part is that I don't have the fixer installed via Atom (checked ~/.atom/packages) nor Homebrew (confirmed with brew list), however, the file is present in /usr/local/bin. If I move it, Atom returns the original error, so it's definitely using this file:
See https://github.com/FriendsOfPHP/PHP-CS-Fixer for program installation instructions.
Your program is properly installed if running 'which php-cs-fixer' in your Terminal returns an absolute path to the executable. If this does not work then you have not installed the program correctly and so Atom Beautify will not find the program. Atom Beautify requires that the program be found in your PATH environment variable.
Note that this is not an Atom Beautify issue if beautification does not work and the above command also does not work: this is expected behaviour, since you have not properly installed your program. Please properly setup the program and search through existing Atom Beautify issues before creating a new issue. See https://github.com/Glavin001/atom-beautify/search?q=php-cs-fixer&type=Issues for related Issues and https://github.com/Glavin001/atom-beautify/tree/master/docs for documentation. If you are still unable to resolve this issue on your own then please create a new issue and ask for help.
Hide Stack Trace
Error: Could not find 'php-cs-fixer'. The program may not be installed.
at PHPCSFixer.module.exports.Beautifier.commandNotFoundError (/Users/ourcore/.atom/packages/atom-beautify/src/beautifiers/beautifier.coffee:204:14)
at /Users/ourcore/.atom/packages/atom-beautify/src/beautifiers/beautifier.coffee:304:22
at tryCatcher (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:510:31)
at Promise._settlePromise (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromise0 (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:687:18)
at Async._drainQueue (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:138:16)
at Async._drainQueues (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:148:10)
at Async.drainQueues (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:17:14)
at process._tickCallback (internal/process/next_tick.js:103:7)
which php-cs-fixer returns /usr/local/bin/php-cs-fixer and my PATH variable currently contains /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/ourcore/.atom/packages/php-cs-fixer.
I guess my questions are, how is the fixer working if the PATH variable seems to be pointing to it in a different location, and how did it end up where it is? Does the location in my PATH matter at all, or does the Atom plugin know to look in /usr/local/bin? I just want to fully understand the entire process before repeating it.
EDIT: On further testing, I removed the Atom directory from my PATH and it didn't affect the plugin, so then I copied the file into the same directory onto the second Mac and it ran without issue, without needing to edit the PATH. Does the fixer file someone inform the OS?
Well first test "which php-cs-fixer" or "where php-cs-fixer" (depending on what os you're running) and if nothing is returned in the terminal then there actually is something wrong on the installation and the best thing to do is to manually install it.
Head to https://github.com/FriendsOfPHP/PHP-CS-Fixer and download it from there and follow the installation steps, after that it should all be good

Zend Framework - sometimes strange errors in few environments

I have project written in Zend Framework and it works fine most of environments.
For example it works good in Windows 7 and Windows XP with popular browsers such as IE, Firefox, Opera and Google Chrome.
In my computer it also works on Ubuntu, but in my friend's computer on ubuntu sometimes it doesn't.
For example: it worked fine yesterday morning, but later it didn't load and there was this error:
Zend_Session::start() - /var/www/try/library/Zend/Loader.php(Line:146):
Error #2 Zend_Loader::include_once() [function.include]: Failed opening 'Req.php' for
inclusion (include_path='.:/var/www/try/application/../library:/var/www/try
/application/../lib:/var/www/try/application/models/:/var/www/try
/application/models/generated/:/var/www/try/application/controllers/:/var
/www/try/application/forms/:.:/usr/share/php') Array
Sometimes even css isn't loaded...
It's like $this->configuration['baseUrl'] suddenly don't work.
What it could be?
Restarting the browser usually helps.
What happened?
An include failed when the application tried to load 'Req.php'
This appears to be that the classes are not autoloading correctly.
What to check?
Check you have the required libraries installed correctly, and matching the folders on your include path. i.e. run a search in your project for Req.php, check this actually exists.
Check where your include path is set - try wrapping the following line in a realpath(), the environment may not like the '../library' in the path.
/var/www/try/application/../library
The answer is that, there was some a problem with session, and the application looked for files from another application, which was used before (application was in the same server).
I found the answer accidently, when I was doing something in that other application and I found there the Req.php file...

Does Aptana Studio change/format files during deploy? Getting 500 error without changes

Using Aptana Studio 3. Does anyone know if Aptana Studio formats or changes files when it does an "auto deploy"?
Didn't make any changes to files while I ported over a Wordpress site to Aptana Studio. When I set up an SFTP connection and enabled auto deploy, it did what looked like a sync and suddenly the server crashed with a 500 error.
PHP Fatal error: Call to undefined function get_header()
Given the error above, it looks like Aptana deleted something. Is there a local history like IntelliJ?
I'm hoping someone can explain if Aptana formats files or deletes them when it does a sync.
Thanks.
Aptana won't delete anything during a sync...but it does do a "safe" upload. It uploads the new file to a temporary file on the server, deletes the original file, and then renames the new one to the old one. The main reason this fails is if there is a mismatch in server permissions such that it can't perform the rename or delete. Fixing those permissions fixes the issue.
As to Local History...try this: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2FgettingStarted%2Fqs-55.htm
I found a very strange result after the Aptana "auto deploy". Essentially, all of the files in the folder under editing were copied and overwritten to the root.
Given the circumstances it looks like an Aptana bug. I double-checked connection settings and folders were set correctly. Perhaps a sign to abandon Aptana.

Symfony project is not work on local pc

I have this trouble: i copy symfony project files on my pc, after that change paths and db settings, and it still not working, even dont tell about errors! Maybe there is some specific actions for setting up symhony on another server?
Almost the same problem How to configure symfony project in local server? but when i try execute "php symfony" it prints "no such file or directory"
There are no any php errors at all.
Using Fedora 15 OS, and apache. php work in command line, symfony is not working. I tried to find out what is happening - inside Controller.class some error, when it use processObjects method, it take 11 objects, and after first of them (header.object.php) it stops.
The white screen generally means symfony can't write to cache and/or log dir, check on apache error logs to see details.
if 'php symfony' on command line throws no such file or directory could mean php is not in your system path.
Please add more information to get answers
myabe, as said below is a permission problem of the caché and log files. Check if they are writable. Good Luck!

Categories