File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
src/PhpSpreadsheet/Helper Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6666- Exclude the vendor folder in migration - [ #481 ] ( https://github.com/PHPOffice/PhpSpreadsheet/issues/481 )
6767- Chained operations on cell ranges involving borders operated on last cell only [ #428 ] ( https://github.com/PHPOffice/PhpSpreadsheet/issues/428 )
6868- Avoid memory exhaustion when cloning worksheet with a drawing [ #437 ] ( https://github.com/PHPOffice/PhpSpreadsheet/issues/437 )
69+ - Migration tool keep variables containing $PHPExcel untouched [ #598 ] ( https://github.com/PHPOffice/PhpSpreadsheet/issues/598 )
6970
7071## [ 1.3.1] - 2018-06-12
7172
Original file line number Diff line number Diff line change @@ -204,7 +204,6 @@ public function getMapping()
204204 'PHPExcel_Settings ' => \PhpOffice \PhpSpreadsheet \Settings::class,
205205 'PHPExcel_Style ' => \PhpOffice \PhpSpreadsheet \Style \Style::class,
206206 'PHPExcel_Worksheet ' => \PhpOffice \PhpSpreadsheet \Worksheet \Worksheet::class,
207- 'PHPExcel ' => \PhpOffice \PhpSpreadsheet \Spreadsheet::class,
208207 ];
209208
210209 $ methods = [
@@ -272,6 +271,11 @@ private function recursiveReplace($path)
272271 $ original = file_get_contents ($ file );
273272 $ converted = str_replace ($ from , $ to , $ original );
274273
274+ // The string "PHPExcel" gets special treatment because of how common it might be.
275+ // This regex requires a word boundary around the string, and it can't be
276+ // preceded by $ or -> (goal is to filter out cases where a variable is named $PHPExcel or similar)
277+ $ converted = preg_replace ('/(?<!\$|->)\bPHPExcel\b/ ' , \PhpOffice \PhpSpreadsheet \Spreadsheet::class, $ original );
278+
275279 if ($ original !== $ converted ) {
276280 echo $ file . " converted \n" ;
277281 file_put_contents ($ file , $ converted );
You can’t perform that action at this time.
0 commit comments