Browse files

Explicitly cast output to strings to avoid XML objects being returned…

… by File_MARCXML

git-svn-id: https://svn.php.net/repository/pear/packages/File_MARC/trunk@301737 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 6bf5fb1 commit c6209671ce0832512d40afc4107064db7f3be472 Dan Scott committed Jul 31, 2010
Showing with 15 additions and 18 deletions.
  1. +2 −2 MARC/Control_Field.php
  2. +3 −3 MARC/Data_Field.php
  3. +2 −2 MARC/Field.php
  4. +1 −1 MARC/Record.php
  5. +3 −3 MARC/Subfield.php
  6. +4 −7 package.xml
View
4 MARC/Control_Field.php
@@ -111,7 +111,7 @@ function delete()
*/
function getData()
{
- return $this->data;
+ return (string)$this->data;
}
// }}}
@@ -168,7 +168,7 @@ function __toString()
*/
function toRaw()
{
- return $this->data.File_MARC::END_OF_FIELD;
+ return (string)$this->data.File_MARC::END_OF_FIELD;
}
// }}}
View
6 MARC/Data_Field.php
@@ -301,9 +301,9 @@ function deleteSubfield(File_MARC_Subfield $subfield)
function getIndicator($ind)
{
if ($ind == 1) {
- return $this->ind1;
+ return (string)$this->ind1;
} elseif ($ind == 2) {
- return $this->ind2;
+ return (string)$this->ind2;
} else {
$errorMessage = File_MARC_Exception::formatError(File_MARC_Exception::$messages[File_MARC_Exception::ERROR_INVALID_INDICATOR_REQUEST], array("indicator" => $indicator));
throw new File_MARC_Exception($errorMessage, File_MARC_Exception::ERROR_INVALID_INDICATOR_REQUEST);
@@ -473,7 +473,7 @@ function toRaw()
$subfields[] = $subfield->toRaw();
}
}
- return $this->ind1.$this->ind2.implode("", $subfields).File_MARC::END_OF_FIELD;
+ return (string)$this->ind1.$this->ind2.implode("", $subfields).File_MARC::END_OF_FIELD;
}
// }}}
}
View
4 MARC/Field.php
@@ -105,7 +105,7 @@ function __destruct()
*/
function getTag()
{
- return $this->tag;
+ return (string)$this->tag;
}
// }}}
@@ -191,7 +191,7 @@ function isDataField()
*/
function __toString()
{
- return $this->getTag();
+ return (string)$this->getTag();
}
// }}}
View
2 MARC/Record.php
@@ -130,7 +130,7 @@ function __destruct()
*/
function getLeader()
{
- return $this->leader;
+ return (string)$this->leader;
}
// }}}
View
6 MARC/Subfield.php
@@ -117,7 +117,7 @@ function delete()
*/
function getCode()
{
- return $this->code;
+ return (string)$this->code;
}
// }}}
@@ -129,7 +129,7 @@ function getCode()
*/
function getData()
{
- return $this->data;
+ return (string)$this->data;
}
// }}}
@@ -155,7 +155,7 @@ public function __toString()
function toRaw()
{
$result = File_MARC::SUBFIELD_INDICATOR.$this->code.$this->data;
- return $result;
+ return (string)$result;
}
// }}}
View
11 package.xml
@@ -19,9 +19,9 @@ This package is based on the PHP MARC package, originally called "php-marc", tha
<email>dbs@php.net</email>
<active>yes</active>
</lead>
- <date>2010-07-30</date>
+ <date>2010-07-31</date>
<version>
- <release>0.5.0</release>
+ <release>0.5.1</release>
<api>0.5.0</api>
</version>
<stability>
@@ -30,11 +30,8 @@ This package is based on the PHP MARC package, originally called "php-marc", tha
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">GNU Lesser General Public License</license>
<notes>
-0.5.0-beta
- * Drop MARCFLAT as it is unmaintained and, to my knowledge, unused
- * Add the ability to generate a proper collection of MARCXML records
- * Factor out some of the common toXML()-related methods to a new base class
- * Add tests of the new toXML() functionality for both MARC and MARCXML sources
+0.5.1-beta
+ * Explicitly cast results to strings to avoid returning XML objects when File_MARCXML is in effect; problem doesn't show up in the PHP CLI, but does cause problems on the Web
</notes>
<contents>
<dir name="/" baseinstalldir="File">

0 comments on commit c620967

Please sign in to comment.