Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Ensure that range related functions had a valid range to work with #29

Closed
wants to merge 3 commits into from

Conversation

lowfill
Copy link

@lowfill lowfill commented Aug 14, 2012

When I tried to run the tests I have this error:

Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'Cell coordinate can not be zero-lenght string'

Looking throuhgt the code I discover that range related functions on Cell class didn't ensure a valid range when the argument is empty.

I fix this and all the test are working again.

@@ -600,6 +600,11 @@ public static function absoluteCoordinate($pCoordinateString = 'A1')
*/
public static function splitRange($pRange = 'A1:A1')
{
// Ensure $pRange is a valid range
if(empty($pRange)){
$pRange = 'A1:A1';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it good idea to rewrite this part as const DEFAULT_RANGE = 'A1:A1' / self::DEFAULT_RANGE. Mb. all things should be replaced? What do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be. I will give it a try ;)

@MarkBaker
Copy link
Member

Thanks. I'd already realised that the changes I'd merged for autofilter expressions had broken saving xls/xlsx files without any autofilter defined - I've implemented the fixes locally and will be committing/merging back to develop later today

@lowfill
Copy link
Author

lowfill commented Aug 15, 2012

I just saw that you updated the code for savi xls/xlsx files without any autofilter. However the changes made directly to Cell class to ensure the range is valid would help to avoid similar problems in the future.

I think that should be merged in the develop branch too.

@MarkBaker
Copy link
Member

Thanks lowfill - I will add those validations as well - but I'd already been working on the fix since it was first brought to my attention and wanted to get it in place as quickly as I could. I still need to rerun all the tests to ensure I haven't missed anything critical, but I'll be committing the more comprehensive fix later (or possibly tomorrow). I'd just had so many people telling me that things were broken here, on codeplex, via mail, via twitter, even to my company email, that I wanted to get that quick fix committed and merged.

It's also why I've still left this open for the moment

@lowfill
Copy link
Author

lowfill commented Aug 15, 2012

Yeap, that was an anoying issue. Yesterday, I spent the whole day debugging it.

For sure all the changes that you are doing will be good for all

@MarkBaker
Copy link
Member

Manual merge will be committed later this evening, thanks for all the work you've done on this

@MarkBaker MarkBaker closed this Aug 16, 2012
@dr-abadis
Copy link

I have same problem with reader!
The error is as below :
Exception information:

Message: Cell coordinate can not be zero-length string
Stack trace:

#0 C:\xampp\htdocs\wimax.shabdiznet.com\library\PHPExcel\Reader\Excel2007.php(935): PHPExcel_Cell::coordinateFromString('')
#1 C:\xampp\htdocs\wimax.shabdiznet.com\application\models\Functions.php(30): PHPExcel_Reader_Excel2007->load('C:\xampp\tmp\ph...')
#2 C:\xampp\htdocs\wimax.shabdiznet.com\application\controllers\ImportController.php(56): Application_Model_Functions::Read_Excel('C:\xampp\tmp\ph...')
#3 C:\xampp\htdocs\wimax.shabdiznet.com\library\Zend\Controller\Action.php(516): ImportController->indexAction()
#4 C:\xampp\htdocs\wimax.shabdiznet.com\library\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch('indexAction')
#5 C:\xampp\htdocs\wimax.shabdiznet.com\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 C:\xampp\htdocs\wimax.shabdiznet.com\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#7 C:\xampp\htdocs\wimax.shabdiznet.com\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#8 C:\xampp\htdocs\wimax.shabdiznet.com\public\index.php(25): Zend_Application->run()
#9 {main}

The uploaded file is file.xlsx
If you want I can Upload file for you to test it

@dr-abadis
Copy link

Sorry Forgot to say that I got latest version from Github and problem still exists

@Progi1984 Progi1984 added this to the 1.8.0 milestone Aug 26, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants