johannes Fri, 12 Feb 2010 00:19:10 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=294942
Log:
merge 290786: Revert 290786: Fixed bug #49521 (PDO fetchObject sets values
before calling constructor)
Bug: http://bugs.php.net/49521 (Closed) PDO fetchObject sets values before
calling constructor
Changed paths:
U php/php-src/branches/PHP_5_3_2/NEWS
U php/php-src/branches/PHP_5_3_2/ext/pdo/pdo_stmt.c
U php/php-src/branches/PHP_5_3_2/ext/pdo/tests/pdo_005.phpt
U
php/php-src/branches/PHP_5_3_2/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
D php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/tests/bug49521.phpt
_U php/php-src/branches/PHP_5_3_2/ext/tidy/tests/
_U
php/php-src/branches/PHP_5_3_2/tests/security/open_basedir_parse_ini_file.phpt
Modified: php/php-src/branches/PHP_5_3_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3_2/NEWS 2010-02-12 00:14:05 UTC (rev 294941)
+++ php/php-src/branches/PHP_5_3_2/NEWS 2010-02-12 00:19:10 UTC (rev 294942)
@@ -6,6 +6,9 @@
- Improved LCG entropy. (Rasmus, Samy Kamkar)
+- Reverted fix for bug #49521 (PDO fetchObject sets values before calling
+ constructor). (Pierrick, Johannes)
+
- Added libpng 1.4.0 support. (Pierre)
- Added support for DISABLE_AUTHENTICATOR for imap_open. (Pierre)
- Added missing host validation for HTTP urls inside FILTER_VALIDATE_URL.
Modified: php/php-src/branches/PHP_5_3_2/ext/pdo/pdo_stmt.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo/pdo_stmt.c 2010-02-12 00:14:05 UTC (rev 294941)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo/pdo_stmt.c 2010-02-12 00:19:10 UTC (rev 294942)
@@ -1034,32 +1034,6 @@
}
}
- switch (how) {
- case PDO_FETCH_CLASS:
- if (ce->constructor && !(flags & (PDO_FETCH_PROPS_LATE | PDO_FETCH_SERIALIZE))) {
- stmt->fetch.cls.fci.object_ptr = return_value;
- stmt->fetch.cls.fcc.object_ptr = return_value;
- if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor" TSRMLS_CC);
- return 0;
- } else {
- if (stmt->fetch.cls.retval_ptr) {
- zval_ptr_dtor(&stmt->fetch.cls.retval_ptr);
- }
- }
- }
- if (flags & PDO_FETCH_CLASSTYPE) {
- do_fetch_opt_finish(stmt, 0 TSRMLS_CC);
- stmt->fetch.cls.ce = old_ce;
- stmt->fetch.cls.ctor_args = old_ctor_args;
- stmt->fetch.cls.fci.param_count = old_arg_count;
- }
- break;
-
- default:
- break;
- }
-
for (idx = 0; i < stmt->column_count; i++, idx++) {
zval *val;
MAKE_STD_ZVAL(val);
@@ -1193,6 +1167,27 @@
}
switch (how) {
+ case PDO_FETCH_CLASS:
+ if (ce->constructor && !(flags & (PDO_FETCH_PROPS_LATE | PDO_FETCH_SERIALIZE))) {
+ stmt->fetch.cls.fci.object_ptr = return_value;
+ stmt->fetch.cls.fcc.object_ptr = return_value;
+ if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor" TSRMLS_CC);
+ return 0;
+ } else {
+ if (stmt->fetch.cls.retval_ptr) {
+ zval_ptr_dtor(&stmt->fetch.cls.retval_ptr);
+ }
+ }
+ }
+ if (flags & PDO_FETCH_CLASSTYPE) {
+ do_fetch_opt_finish(stmt, 0 TSRMLS_CC);
+ stmt->fetch.cls.ce = old_ce;
+ stmt->fetch.cls.ctor_args = old_ctor_args;
+ stmt->fetch.cls.fci.param_count = old_arg_count;
+ }
+ break;
+
case PDO_FETCH_FUNC:
stmt->fetch.func.fci.param_count = idx;
stmt->fetch.func.fci.retval_ptr_ptr = &retval;
Modified: php/php-src/branches/PHP_5_3_2/ext/pdo/tests/pdo_005.phpt
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo/tests/pdo_005.phpt 2010-02-12 00:14:05 UTC (rev 294941)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo/tests/pdo_005.phpt 2010-02-12 00:19:10 UTC (rev 294942)
@@ -34,7 +34,7 @@
public function __construct(&$row)
{
- echo __METHOD__ . "($row)\n";
+ echo __METHOD__ . "($row,{$this->id})\n";
$this->row = $row++;
}
}
@@ -108,9 +108,9 @@
string(2) "CC"
}
}
-TestDerived::__construct(0)
-TestDerived::__construct(1)
-TestDerived::__construct(2)
+TestDerived::__construct(0,1)
+TestDerived::__construct(1,2)
+TestDerived::__construct(2,3)
array(3) {
[0]=>
object(TestDerived)#%d (5) {
@@ -151,4 +151,4 @@
["val2"]=>
string(2) "CC"
}
-}
+}
\ No newline at end of file
Modified: php/php-src/branches/PHP_5_3_2/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt 2010-02-12 00:14:05 UTC (rev 294941)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt 2010-02-12 00:19:10 UTC (rev 294942)
@@ -71,21 +71,21 @@
MySQLPDOTest::dropTestTable();
?>
--EXPECTF--
-myclass::__construct(0, 1): 0 / 0
myclass::__set(id, -'1'-) 1
myclass::__set(, -''-) 2
myclass::__set(null, -NULL-) 3
myclass::__set(, -''-) 4
-myclass::__construct(1, 2): 4 / 0
+myclass::__construct(0, 1): 4 / 4
myclass::__set(id, -'2'-) 1
myclass::__set(, -''-) 2
myclass::__set(null, -NULL-) 3
myclass::__set(, -''-) 4
-myclass::__construct(2, 3): 8 / 0
+myclass::__construct(1, 2): 8 / 4
myclass::__set(id, -'3'-) 1
myclass::__set(, -''-) 2
myclass::__set(null, -NULL-) 3
myclass::__set(, -''-) 4
+myclass::__construct(2, 3): 12 / 4
object(myclass)#%d (4) {
[%u|b%"set_calls":"myclass":private]=>
int(4)
@@ -96,4 +96,4 @@
[%u|b%"null"]=>
NULL
}
-done!
+done!
\ No newline at end of file
Deleted: php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/tests/bug49521.phpt
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/tests/bug49521.phpt 2010-02-12 00:14:05 UTC (rev 294941)
+++ php/php-src/branches/PHP_5_3_2/ext/pdo_sqlite/tests/bug49521.phpt 2010-02-12 00:19:10 UTC (rev 294942)
@@ -1,39 +0,0 @@
---TEST--
-Bug #49521 (PDO fetchObject sets values before calling constructor)
---SKIPIF--
-<?php
-if (!extension_loaded('pdo_sqlite')) die ("skip Need PDO_SQlite support");
-?>
---FILE--
-<?php
-
-class Book {
- public $title = 'test';
- public $author;
-
- public function __construct($x) {
- $this->title = '';
- echo __METHOD__,"\n";
- }
- public function __set($a, $b) {
- echo __METHOD__,"\n";
- var_dump($a);
- }
-}
-
-$pdo = new PDO('sqlite::memory:');
-$pdo->exec('CREATE TABLE book(title,author)');
-$pdo->exec('INSERT INTO book VALUES ("PHP","Rasmus")');
-$statement = $pdo->prepare('SELECT * FROM book WHERE title="PHP"');
-$statement->execute();
-var_dump($statement->fetchObject('Book', array(1)));
-
-?>
---EXPECTF--
-Book::__construct
-object(Book)#%d (2) {
- [%u|b%"title"]=>
- string(3) "PHP"
- [%u|b%"author"]=>
- string(6) "Rasmus"
-}
Property changes on: php/php-src/branches/PHP_5_3_2/ext/tidy/tests
___________________________________________________________________
Modified: svn:mergeinfo
- /php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292620,292635,292716,292719,292765,293146,293152,293175-293176,293180,293216,293235,293253,293380,293400,293409,293437,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293721,293726-293728,293730,293732,293735,293762,293768,293804,293813,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294762,294814,294816,294825,294849,294854-294855,294866,294882
/php/php-src/trunk/ext/tidy/tests:29815-29816,284726,287798-287941
+ /php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292620,292635,292716,292719,292765,293146,293152,293175-293176,293180,293216,293235,293253,293341,293380,293400,293409,293437,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293721,293726-293728,293730,293732,293735,293762,293768,293804,293813,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294762,294814,294816,294825,294849,294854-294855,294866,294882,294903
/php/php-src/trunk/ext/tidy/tests:29815-29816,284726,287798-287941
Property changes on: php/php-src/branches/PHP_5_3_2/tests/security/open_basedir_parse_ini_file.phpt
___________________________________________________________________
Modified: svn:mergeinfo
- /php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt:292562,292566,292571,292574,292620,292716,293146,293152,293175-293176,293180,293216,293235,293253,293380,293400,293409,293437,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293721,293726-293728,293730,293732,293735,293762,293768,293804,293813,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294762,294814,294816,294825,294849,294854-294855,294866,294882
/php/php-src/trunk/tests/security/open_basedir_parse_ini_file.phpt:29815-29816,265951
+ /php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt:292562,292566,292571,292574,292620,292716,293146,293152,293175-293176,293180,293216,293235,293253,293341,293380,293400,293409,293437,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293721,293726-293728,293730,293732,293735,293762,293768,293804,293813,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294762,294814,294816,294825,294849,294854-294855,294866,294882,294903
/php/php-src/trunk/tests/security/open_basedir_parse_ini_file.phpt:29815-29816,265951
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php