Author: stas Date: Fri Feb 18 18:02:26 2005 New Revision: 154382 URL: http://svn.apache.org/viewcvs?view=rev&rev=154382 Log: fix a bug in $r->document_root, which previously weren't copying the new string away
Modified: perl/modperl/trunk/Changes perl/modperl/trunk/t/response/TestAPI/request_util.pm perl/modperl/trunk/xs/Apache/RequestUtil/Apache__RequestUtil.h Modified: perl/modperl/trunk/Changes URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&r1=154381&r2=154382 ============================================================================== --- perl/modperl/trunk/Changes (original) +++ perl/modperl/trunk/Changes Fri Feb 18 18:02:26 2005 @@ -12,6 +12,9 @@ =item 1.999_22-dev +fix a bug in $r->document_root, which previously weren't copying the +new string away [Stas] + introduce a new build option MP_AP_DESTDIR to aid package builders direct the Apache-specific files to the right place. [Cory Omand <[EMAIL PROTECTED]>] Modified: perl/modperl/trunk/t/response/TestAPI/request_util.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPI/request_util.pm?view=diff&r1=154381&r2=154382 ============================================================================== --- perl/modperl/trunk/t/response/TestAPI/request_util.pm (original) +++ perl/modperl/trunk/t/response/TestAPI/request_util.pm Fri Feb 18 18:02:26 2005 @@ -31,8 +31,12 @@ ok $document_root; if (!Apache::MPM->is_threaded) { - ok t_cmp($document_root, $r->document_root('/tmp/foo')); - ok t_cmp('/tmp/foo', $r->document_root($document_root)); + my $path_orig = my $path = '/tmp/foo'; + ok t_cmp($document_root, $r->document_root($path)); + # make sure that the new docroot string is copied internally, + # and later manipulations of the passed scalar don't affect it + $path .= "suffix"; + ok t_cmp($path_orig, $r->document_root($document_root)); } else { eval { $r->document_root('/tmp/foo') }; Modified: perl/modperl/trunk/xs/Apache/RequestUtil/Apache__RequestUtil.h URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/Apache/RequestUtil/Apache__RequestUtil.h?view=diff&r1=154381&r2=154382 ============================================================================== --- perl/modperl/trunk/xs/Apache/RequestUtil/Apache__RequestUtil.h (original) +++ perl/modperl/trunk/xs/Apache/RequestUtil/Apache__RequestUtil.h Fri Feb 18 18:02:26 2005 @@ -320,7 +320,7 @@ MP_CROAK_IF_THREADS_STARTED("setting $r->document_root"); conf = ap_get_module_config(r->server->module_config, &core_module); - conf->ap_document_root = SvPV_nolen(new_root); + conf->ap_document_root = apr_pstrdup(r->pool, SvPV_nolen(new_root)); } return retval;