From a21b619e86255148cd257ee0063c2fb0ecc3ec8b Mon Sep 17 00:00:00 2001 From: Julien Dephix Date: Sun, 8 Dec 2024 17:49:11 +0100 Subject: [PATCH 1/2] Adds a toggle to allow shape files with no dbf (#41) Adds a toggle to allow shape files with no dbf Fixes https://github.com/phpmyadmin/shapefile/issues/36 Closes https://github.com/phpmyadmin/shapefile/pull/38 --- data/no-dbf.shp | Bin 0 -> 51924 bytes data/no-dbf.shx | Bin 0 -> 356 bytes src/ShapeFile.php | 26 ++++++++++++++++++++++---- tests/ShapeFileTest.php | 11 +++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/data/no-dbf.shp b/data/no-dbf.shp index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..aa19d09b028bae0df7de9d01df594223f15c731a 100644 GIT binary patch literal 51924 zcmZ|21-Ms5_x?R}iwH{NmKLN#B!?~mdFb9C-O?a2NQ%B@-X#|FnmXHQzlOpgO zk#7F`-1q+SysqS|YNskUv%!Dr%W3oI z=zkNht{2Uwd{Z58>_SS#Iv()<-%l*1;?@;;slQ*B&_M#XaNedi_!oHvMXFK3Z}iVw z!Eb8(mva880vk0pZYdr7FVm(L*fvT5_RcpYx2g)ZyItB(tpQe@+LF6;r@o~%SPvdb zePtW4X*U(D?>3_Sh%doz(*|Ix+tI#9L)zc24K@d=lWSI|?tDu7_p_28R|e~p$-(k| z^uR;VRo(a{qwmk}@f*{BmKN-6JI(YNQiHwcM`_=yIM_ZoPW}96Oy7aJx!9cCgZb-} zwZN+J0oa>EdBC!Kooy#{Z`{2y(buEO?V^3shhTfhf>rCAVE@(6)caqjebh#$RfY-ZggKdndJdWiPF)ujE{ zlhnJge(NE}$hla*)zJZ9m9s4D?dxvjVjq*Ey3+nk$YUx|?^KZacP;>SP8Fd2>;&L9 zeZ)iswk6nSMEVdN=WE!zS*Yt0qroO4+mp^U3app1zWYCZL;XcLmXmu;1e~?M(~X*NqL`Hln@h8;ABK4l{k}WMI?&8d!b# zHtq921iLp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y)i($Ayu5$=cPX$xhWm_8?#5)X&nEZbB4d*d_vz$5o(=c? zBKv$1j_d=dApd`%Xz;J*9ju)0_qR08>rSfInUq0brqHN8Q#B{{yFPY+h52v z>Vj3531F459(CInY*#b}n|2k+L%EJ)vN0B?-A%tpAMZy!jKi(Ae@*@|^uyvG1e#QTW*^gV0Pk+k% z-#Nzi{-he%y!%7go^zAS%0Ge&4r`nf_K4s^AWK6l59Kd zroKOniIL-X>U;0QUd7r0w#lB5Q|u&Xf5iOrZe;qYEYD8fPM&s+dfb&@b%QZ*f^{^e z|BY;xAENyZ+N)Jze)EnXy-u=$>8tH#`TxuTn<6`z|HX04ufb2`U5qKD(=R4(j>K}D z2e#j2WBQ$A!0K#4u>6+4{MNsW1)xN%02xcbidX|m#v+ih3Pdae8SB7^SO`J=kK8Z5 M=__L?{LA0}f8rep{Qv*} literal 0 HcmV?d00001 diff --git a/data/no-dbf.shx b/data/no-dbf.shx index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..8555f79d12cd9220d93f7d70e123477484e4e489 100644 GIT binary patch literal 356 zcmZ{dElY!86o#+8d;MUF2qI2lIKNQA!O($V@rA)wM1vneCW^r<1~HmM#9%NClk5*T zmJ9}ef(F4Pt__pHU@&;SXw(CT`?>DtKIgz>iodJTNfileLength = 50; } + public function setAllowNoDbf(bool $allowNoDbf): void + { + $this->allowNoDbf = $allowNoDbf; + } + /** * Loads shapefile and dbase (if supported). * @@ -326,8 +334,16 @@ public function getIndexFromDBFData(string $field, $value): int */ private function loadDBFHeader(): array { - $DBFFile = fopen($this->getFilename('.dbf'), 'r'); + if (! self::supportsDbase()) { + return []; + } + $dbfName = $this->getFilename('.dbf'); + if (! file_exists($dbfName)) { + return []; + } + + $DBFFile = fopen($dbfName, 'r'); $result = []; $i = 1; $inHeader = true; @@ -405,9 +421,7 @@ private function loadHeaders(): bool $this->boundingBox['mmin'] = Util::loadData('d', $this->readSHP(8)); $this->boundingBox['mmax'] = Util::loadData('d', $this->readSHP(8)); - if (self::supportsDbase()) { - $this->dbfHeader = $this->loadDBFHeader(); - } + $this->dbfHeader = $this->loadDBFHeader(); return true; } @@ -620,6 +634,10 @@ private function openDBFFile(): bool $dbfName = $this->getFilename('.dbf'); if (! is_readable($dbfName)) { + if ($this->allowNoDbf) { + return true; + } + $this->setError(sprintf('It wasn\'t possible to find the DBase file "%s"', $dbfName)); return false; diff --git a/tests/ShapeFileTest.php b/tests/ShapeFileTest.php index 505825b..35c0e4b 100644 --- a/tests/ShapeFileTest.php +++ b/tests/ShapeFileTest.php @@ -548,4 +548,15 @@ public function testSearch(): void $shp->getIndexFromDBFData('CNTRY_NAME', 'Czech Republic') ); } + + public function testAllowsNoDbf(): void + { + if (! ShapeFile::supportsDbase()) { + self::markTestSkipped(); + } + + $shp = new ShapeFile(0); + $shp->setAllowNoDbf(true); + self::assertTrue($shp->loadFromFile('data/no-dbf.*')); + } } From 76a519a241028ff68be6c4ca5ef90cf534356902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sun, 8 Dec 2024 13:53:09 -0300 Subject: [PATCH 2/2] Add change log entry for #41 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ci skip] Signed-off-by: MaurĂ­cio Meneghini Fauth --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e012a70..bb86705 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [Unreleased] +## [3.1.0] - YYYY-MM-DD + +### Added + +- Adds a toggle to allow shape files with no dbf (#41) ## [3.0.2] - 2023-09-11 ### Added @@ -118,7 +122,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - Initial release based on bfShapeFiles -[Unreleased]: https://github.com/phpmyadmin/shapefile/compare/3.0.2...HEAD +[3.1.0]: https://github.com/phpmyadmin/shapefile/compare/3.0.2...3.1.x [3.0.2]: https://github.com/phpmyadmin/shapefile/compare/3.0.1...3.0.2 [3.0.1]: https://github.com/phpmyadmin/shapefile/compare/3.0.0...3.0.1 [3.0.0]: https://github.com/phpmyadmin/shapefile/compare/2.1...3.0.0