Skip to content

Commit

Permalink
#8284 Patch ADODB for error handling in newer PHPs
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Sep 23, 2022
1 parent d336e73 commit 0051bd9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"patches": {
"adodb/adodb-php": {
"Apply PKP ADODB patches": "lib/adodb.diff",
"Apply PKP ADODB PHP8.1 patches": "lib/adodb-php8.1.diff"
"Apply PKP ADODB PHP8.1 patches": "lib/adodb-php8.1.diff",
"Apply PKP ADODB patches for error handling": "lib/adodb-datadict-errors.diff"
}
}
},
Expand Down
33 changes: 33 additions & 0 deletions lib/adodb-datadict-errors.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--- adodb-xmlschema.inc.php 2022-09-22 17:02:09.997038474 -0700
+++ adodb-xmlschema.inc.php 2022-09-22 17:30:42.099756162 -0700
@@ -480,8 +480,14 @@
function create( &$xmls ) {
$sql = array();

+ $tableExists = in_array($this->name, $xmls->dict->MetaTables());
// drop any existing indexes
- if( is_array( $legacy_indexes = $xmls->dict->MetaIndexes( $this->name ) ) ) {
+ if ($tableExists) {
+ $legacy_indexes = $xmls->dict->MetaIndexes($this->name);
+ } else {
+ $legacy_indexes = false;
+ }
+ if( is_array( $legacy_indexes ) ) {
foreach( $legacy_indexes as $index => $index_details ) {
$sql[] = $xmls->dict->DropIndexSQL( $index, $this->name );
}
@@ -492,8 +498,13 @@
unset( $this->fields[$field] );
}

+ if ($tableExists) {
+ $legacy_fields = $xmls->dict->MetaColumns($this->name);
+ } else {
+ $legacy_fields = false;
+ }
// if table exists
- if( is_array( $legacy_fields = $xmls->dict->MetaColumns( $this->name ) ) ) {
+ if( is_array( $legacy_fields ) ) {
// drop table
if( $this->drop_table ) {
$sql[] = $xmls->dict->DropTableSQL( $this->name );

0 comments on commit 0051bd9

Please sign in to comment.