possible bug in sql/data.php

From: Date: Sat, 11 Jun 2011 20:21:48 +0000
Subject: possible bug in sql/data.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-11183@lists.php.net to get a copy of this message
hi. sorry for the crossposting, but I have a feeling that not many people reads the peclweb@php.net mailing list. yesterday I set out a local developer environment for contributing to the peclweb source, and I've noticed that executing make create in the sql directory which is stated in the sql/README fails with this error: processing notes.sql... PHP Warning: extract() expects parameter 1 to be array, null given in /var/www/apache/vhosts/pecl.php.dev/sql/data.php on line 7 PHP Stack trace: PHP 1. {main}() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:0 PHP 2. extract() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:7 Warning: extract() expects parameter 1 to be array, null given in /var/www/apache/vhosts/pecl.php.dev/sql/data.php on line 7 Call Stack: 0.0003 643136 1. {main}() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:0 0.0279 6079680 2. extract() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:7 Adding users... 17 users added. Adding categories... PHP Fatal error: Call to a member function saveCategoryREST() on a non-object in /var/www/apache/vhosts/pecl.php.dev/include/pear-database.php on line 177 PHP Stack trace: PHP 1. {main}() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:0 PHP 2. include() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:17 PHP 3. category::add() /var/www/apache/vhosts/pecl.php.dev/sql/addcategories.php:46 Fatal error: Call to a member function saveCategoryREST() on a non-object in /var/www/apache/vhosts/pecl.php.dev/include/pear-database.php on line 177 Call Stack: 0.0003 643136 1. {main}() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:0 0.0434 6918864 2. include('/var/www/apache/vhosts/pecl.php.dev/sql/addcategories.php') /var/www/apache/vhosts/pecl.php.dev/sql/data.php:17 0.0455 6968664 3. category::add() /var/www/apache/vhosts/pecl.php.dev/sql/addcategories.php:46 make: *** [prime] Error 255 AFAIK the problem is that the data.php should include the include/pear-prepend.php file, because that file sets the $pear_rest variable which is used by this script. I've added the necessary require_once "../include/pear-prepend.php"; to data.php but now I got the following error processing notes.sql... PHP Fatal error: Cannot redeclare error_handler() (previously declared in /var/www/apache/vhosts/pecl.php.dev/sql/data.php:22) in /var/www/apache/vhosts/pecl.php.dev/include/pear-format-html.php on line 393 PHP Stack trace: PHP 1. {main}() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:0 PHP 2. require_once() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:4 Fatal error: Cannot redeclare error_handler() (previously declared in /var/www/apache/vhosts/pecl.php.dev/sql/data.php:22) in /var/www/apache/vhosts/pecl.php.dev/include/pear-format-html.php on line 393 Call Stack: 0.0005 643680 1. {main}() /var/www/apache/vhosts/pecl.php.dev/sql/data.php:0 0.0048 1299328 2. require_once('/var/www/apache/vhosts/pecl.php.dev/include/pear-prepend.php') /var/www/apache/vhosts/pecl.php.dev/sql/data.php:4 make: *** [prime] Error 255 as you can see, both the data.sql and the pear-format-html.php (which is included by the pear-prepend.php) defines the error_handler function. my fix would be to rename that function and the setErrorHandling reference to data_error_handler for example. this two changes (adding the require_once "../include/pear-prepend.php"; line and renaming the error_handler) fixes this problem for me. could someone review this modification before I commit this? here is the patch: https://gist.github.com/1020915 Tyrael

« previous php.webmaster (#11183) next »