Skip to content

Commit 4426cdf

Browse files
authored
Merge pull request #4 from magento-gl/fixes-magento2-issue-37897
Fixed regression from fixing PHP 8.2 deprecated usages earlier, which broke rendering certain elements in a pdf in Magento
2 parents 243d76f + 6047a4a commit 4426cdf

File tree

7 files changed

+113
-11
lines changed

7 files changed

+113
-11
lines changed

library/Zend/Pdf/Element.php

+1-11
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ abstract class Zend_Pdf_Element
4545
*/
4646
private $_parentObject = null;
4747

48-
/**
49-
* Object value
50-
*
51-
* @var string
52-
*/
53-
public $value;
54-
5548
/**
5649
* Return type of the element.
5750
* See ZPdfPDFConst for possible values
@@ -138,10 +131,7 @@ public function cleanUp()
138131
*
139132
* @return mixed
140133
*/
141-
public function toPhp()
142-
{
143-
return $this->value;
144-
}
134+
abstract public function toPhp();
145135

146136
/**
147137
* Convert PHP value into PDF element.

library/Zend/Pdf/Element/Boolean.php

+19
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
*/
3535
class Zend_Pdf_Element_Boolean extends Zend_Pdf_Element
3636
{
37+
/**
38+
* Object value
39+
*
40+
* @var boolean
41+
*/
42+
public $value;
43+
44+
3745
/**
3846
* Object constructor
3947
*
@@ -72,4 +80,15 @@ public function toString($factory = null)
7280
{
7381
return $this->value ? 'true' : 'false';
7482
}
83+
84+
85+
/**
86+
* Convert PDF element to PHP type.
87+
*
88+
* @return boolean
89+
*/
90+
public function toPhp()
91+
{
92+
return $this->value;
93+
}
7594
}

library/Zend/Pdf/Element/Name.php

+19
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
*/
3535
class Zend_Pdf_Element_Name extends Zend_Pdf_Element
3636
{
37+
/**
38+
* Object value
39+
*
40+
* @var string
41+
*/
42+
public $value;
43+
44+
3745
/**
3846
* Object constructor
3947
*
@@ -150,4 +158,15 @@ public function toString($factory = null)
150158
{
151159
return '/' . self::escape((string)$this->value);
152160
}
161+
162+
163+
/**
164+
* Convert PDF element to PHP type.
165+
*
166+
* @return string
167+
*/
168+
public function toPhp()
169+
{
170+
return $this->value;
171+
}
153172
}

library/Zend/Pdf/Element/Null.php

+19
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
*/
3535
class Zend_Pdf_Element_Null extends Zend_Pdf_Element
3636
{
37+
/**
38+
* Object value. Always null.
39+
*
40+
* @var mixed
41+
*/
42+
public $value;
43+
44+
3745
/**
3846
* Object constructor
3947
*/
@@ -64,4 +72,15 @@ public function toString($factory = null)
6472
{
6573
return 'null';
6674
}
75+
76+
77+
/**
78+
* Convert PDF element to PHP type.
79+
*
80+
* @return mixed
81+
*/
82+
public function toPhp()
83+
{
84+
return $this->value;
85+
}
6786
}

library/Zend/Pdf/Element/Numeric.php

+19
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
*/
3535
class Zend_Pdf_Element_Numeric extends Zend_Pdf_Element
3636
{
37+
/**
38+
* Object value
39+
*
40+
* @var numeric
41+
*/
42+
public $value;
43+
44+
3745
/**
3846
* Object constructor
3947
*
@@ -84,4 +92,15 @@ public function toString($factory = null)
8492
}
8593
return sprintf("%.{$prec}F", $this->value);
8694
}
95+
96+
97+
/**
98+
* Convert PDF element to PHP type.
99+
*
100+
* @return numeric
101+
*/
102+
public function toPhp()
103+
{
104+
return $this->value;
105+
}
87106
}

library/Zend/Pdf/Element/Stream.php

+18
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
*/
3838
class Zend_Pdf_Element_Stream extends Zend_Pdf_Element
3939
{
40+
/**
41+
* Object value
42+
*
43+
* @var Zend_Memory_Container
44+
*/
45+
public $value;
46+
47+
4048
/**
4149
* Object constructor
4250
*
@@ -119,4 +127,14 @@ public function toString($factory = null)
119127
{
120128
return "stream\n" . $this->value->getRef() . "\nendstream";
121129
}
130+
131+
/**
132+
* Convert PDF element to PHP type.
133+
*
134+
* @return Zend_Memory_Container
135+
*/
136+
public function toPhp()
137+
{
138+
return $this->value;
139+
}
122140
}

library/Zend/Pdf/Element/String.php

+18
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
*/
3434
class Zend_Pdf_Element_String extends Zend_Pdf_Element
3535
{
36+
/**
37+
* Object value
38+
*
39+
* @var string
40+
*/
41+
public $value;
42+
3643
/**
3744
* Object constructor
3845
*
@@ -67,6 +74,17 @@ public function toString($factory = null)
6774
}
6875

6976

77+
/**
78+
* Convert PDF element to PHP type.
79+
*
80+
* @return string
81+
*/
82+
public function toPhp()
83+
{
84+
return $this->value;
85+
}
86+
87+
7088
/**
7189
* Escape string according to the PDF rules
7290
*

0 commit comments

Comments
 (0)