What steps will reproduce the problem? 1. Run the 0.4.5 spyc for php4
Parse error: syntax error, unexpected T_NEW in spyc_php4.inc on line 322
322: if ($first_key===0) throw new Exception('Keys are all screwy. The first one was zero, now it\'s "'. $key .'"');
I have used the included php4 version and tried the 5to4.php (which seems to produce the same file).
Should the 5to4 be extended to also change php5's error throwing mechanism or should the users do that themselves?
Any takes on this?
Comment #1
Posted on Oct 8, 2009 by Helpful ElephantI had this same problem. Run 5to4.php. This creates spyc-latest.php4. I renamed it to spyc-php4.php. When running that, I got the error mentioned above. I also added the brackets because that's my preference, but it properly works without them.
I resolved it by removing "throw" from line 322. if ($first_key===0) { new Exception('Keys are all screwy. The first one was zero, now it\'s "'. $key .'"'); }
I have only done some basic testing, but it's not dying anymore.
Comment #2
Posted on Mar 9, 2010 by Grumpy DogYou need to add $code = preg_replace ('#throw new Exception\(([^)]*)\)#i', 'trigger_error($1,E_USER_ERROR)', $code); in 5to4.php
- 5to4.php 728
Comment #3
Posted on Mar 20, 2011 by Happy PandaThanks, fixed it in the SVN trunk.
Status: Fixed
Labels:
Type-Defect
Priority-Medium